Thursday, February 4, 2010

tower of hanoi


describe the straggy and formula for the puzzzle tower of hanoi


From the moves necessary to transfer one, two, and three disks, we can find a recursive pattern - a pattern that uses information from one step to find the next step - for moving n disks from post A to post C:
First, transfer n-1 disks from post A to post B. The number of moves will be the same as those needed to transfer n-1 disks from post A to post C. Call this number M moves. [As you can see above, with three disks it takes 3 moves to transfer two disks (n-1) from post A to post C.]
Next, transfer disk 1 to post C [1 move].
Finally, transfer the remaining n-1 disks from post B to post C. [Again, the number of moves will be the same as those needed to transfer n-1 disks from post A to post C, or M moves.]

No comments:

Post a Comment