
978 CHAPTER 13 Recursion
DISCUSSION QUESTIONS
1. What is the base case for the method?
2. As the number of disks increases,what happens to the time it takes for the method
to run?
?
method so that the code animates. The API of moveDisk is
explained in Example 13.9.
3. Finally, you need to move all the disks from the useTower (tem-
porary tower, “middle tower” on the figures) to the toTower
(destination tower, “right tower” on the figures). Again, you call
recursiveTOfH.
For example, if you run your program with three disks, and
assuming the towers are labeled 0, 1, and 2 from left to right, the
command line output of your method should read something like: ...