All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Towers of Hanoi (Posted on 2003-09-07) Difficulty: 3 of 5
You have three small poles and five hoops - XS, S, M, L, XL (as in extra small, small, medium, large and extra large). They are placed on pole 1 in order, with largest at the bottom.

You can move one hoop at a time, and the hoops you are not moving have to be on a pole. You also cannot place a hoop on top of a smaller one. How can you move the hoops so that they are in the same order as they are now, but on pole 3?

See The Solution Submitted by Lewis    
Rating: 3.0667 (15 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
strategy | Comment 5 of 21 |
The strategy for moving n hoops to pole 3 is first to move n-1 hoops to pole 2, then move the nth hoop to pole 3 and then move the other n-1 hoops onto pole 3. Defining the problem this way is known as recursion. Eventually you have broken it down into the problem of moving just 1 hoop. It's apparent that the target of the bottom (nth) hoop is to be pole 3; the target of hoop n-1 is to be pole 2; etc, alternating.

From this description, the number of moves necessary for n hoops is one more than twice the number required for n-1 hoops, as n-1 must be moved to the non-target pole, the nth moved to the target pole and then the n-1 must be moved again to the target pole.

So the sequence showing the number of required moves is:

Edited on September 7, 2003, 11:24 am
Edited on September 7, 2003, 3:48 pm
  Posted by Charlie on 2003-09-07 11:23:12
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information