What is tower of hanoi problem in data structure?
Answers
Answered by
0
We mark three towers with name, source, destination and aux (only to help moving the disks). If we have only one disk, then it can easily be moved from source to destination peg.
If we have 2 disks −
First, we move the smaller (top) disk to aux peg.Then, we move the larger (bottom) disk to destination peg.
And finally, we move the smaller disk from aux to destination peg.
Similar questions