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?
I am still trying induction so if I made a mistake in that last post, just tell me please! :)
I have another challenge: How could you use recursion in a program to print out a list of hoops when given the number x of how many hoops they are? (Refer to the hoops as A, B, C and so on to reduce counting the X before a S or L)
Sample out put when x=3:
Move A from 1 to 3
Move B from 1 to 2
Move A from 3 to 2
Move C from 1 to 3
Move A from 2 to 1
Move B from 2 to 3
Move A from 1 to 3
Edited on September 7, 2003, 2:47 pm
|
Posted by Gamer
on 2003-09-07 14:19:04 |