Annotate the lines of output of the SolveTowers program in this chapter to show the recursive steps.
What will be an ideal response?
Move one disk from 1 to 2 // called with numDisks = 1
Move one disk from 1 to 3 // called with numDisks = 2
Move one disk from 2 to 3 // called with numDisks = 1
Move one disk from 1 to 2 // called with numDisks = 3
Move one disk from 3 to 1 // called with numDisks = 1
Move one disk from 3 to 2 // called with numDisks = 2
Move one disk from 1 to 2 // called with numDisks = 1
Move one disk from 1 to 3 // called with numDisks = 4
Move one disk from 2 to 3 // called with numDisks = 1
Move one disk from 2 to 1 // called with numDisks = 2
Move one disk from 3 to 1 // called with numDisks = 1
Move one disk from 2 to 3 // called with numDisks = 3
Move one disk from 1 to 2 // called with numDisks = 1
Move one disk from 1 to 3 // called with numDisks = 2
Move one disk from 2 to 3 // called with numDisks = 1
Note the symmetry around the line where a call is made with numDisks = 4.
You might also like to view...
In order for the XSL code to be valid, the _______ line of HTML must be present.
What will be an ideal response?
Determine the order of the recursive maze solution presented in this chapter.
What will be an ideal response?
An automatic column break in Word aligns text in columns
Indicate whether the statement is true or false
How would you direct the DatePart function to display only the year of a field named BirthDate?
What will be an ideal response?