|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Problems
Problem 6.1:
Write a function that takes the same arguments as TOH but instead of
printing out the solution, returns the number of disc moves in solving
the problem.
[Solution]
Problem 6.2:
If the only change in the rules of the Towers of Hanoi problem were that
you only had two poles instead of three, would the problem still be
solvable?
[Solution]
Problem 6.3:
If you have a problem that has a recurrence relation of
T(n) = 2T(n/2) + 1, T(1) = 1, what would be an appropriate
big-O notation?
[Solution]
Problem 6.4:
CHALLENGE: Write an iterative solution to the Towers of Hanoi problem.
[Solution]
Problem 6.5:
In the iterative solution presented above, what is the purpose of the
1 << n? How does this relate to Towers of Hanoi?
[Solution]
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contact Us | Privacy Policy | Terms and Conditions | About
©2006 SparkNotes LLC, All Rights Reserved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||