Question
(Nonrecursive Tower of Hanoi) Implement the moveDisks method in Listing 18.8 using a stack instead of using recursion.
Step 1
The Tower of Hanoi is a classic problem where you have three rods and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks neatly stacked in ascending order of size on one rod, the smallest at the top, making a Show more…
Show all steps
Your feedback will help us improve your experience
Watch the video solution with this free unlock.
EMAIL
PASSWORD