This is a Towers of Hanoi game. Cut out the pieces and follow the rules: Imagine that there are three pegs. All the disks are on one of the pegs, stacked with the largest on the bottom and decreasing in size until the smallest is on the top. Your goal is to move all the disks from peg one to peg 3. However, you may only move one disk at a time and you may never place a larger disk on top of a smaller one.

Try to think of a recursive algorithm for what you are doing. What is the big-O of this algorithm in terms of moves?





If you have questions, please send mail to:
owens@docs.uu.se
Revised Thursday 12 September 9:50