Visualize the classic Tower of Hanoi recursive algorithm. Watch disks move between pegs following strict rules to solve the puzzle with minimum moves.
A mathematical puzzle where we move a stack of disks from one rod to another, following simple recursive rules.
1) Only one disk can be moved at a time. 2) Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack. 3) No larger disk may be placed on top of a smaller disk.
To move n disks from Source to Destination: 1) Move n-1 disks from Source to Auxiliary. 2) Move the nth (largest) disk from Source to Destination. 3) Move n-1 disks from Auxiliary to Destination.
The recursion ends when we have 0 disks to move. At this point, the function simply returns without taking any action.
In the visualizer, you can see disks being moved between pegs. The colors and animations help trace the path of each disk as the recursive calls stack up.
The number of moves required to solve a Tower of Hanoi puzzle is 2^n - 1, where n is the number of disks.