You are on page 1of 10

The Tower of Hanoi

1 1 1
2 1 1
2 3
3 1 1
2 3
3 7
4 1 1
2 3
3 7
4 15

7+8=15
DATA 2n
If x= min
1 1 2
number of
2 3 4 moves:
3 7 8 xn=2n-1

4 15 16
5 31 32
6 63 64
7 127 128
8 255 256
Proof By Induction
• Recursion
• Assume the formula for the minimum number of moves to
achieve the goal is:
Xn=2n-1 for all values up to n
• Prove true for Xn+1
• Xn+1=Xn+1+Xn
=(2n-1)+1+(2n-1)
=2(2n-1)+1
=2n+1-1
Bicolor Variation

Goal: to arrange the disks such that each of the


towers is all one color. The two largest disks must
also swap positions.

Rules: A larger disk may never be placed on a


smaller disk, but disks of equal size may be placed
on top of each other.
Multiple Post Variations

With more posts, transferring the disks should require fewer moves.
Here is some data we came across regarding the minimum
number of moves required to transfer n disks to another post:
n t=4 Increase

1 1
2 3 2
3 5 2
4 9 4
5 13 4
6 17 4
7 25 8
8 33 8
9 41 8
10 49 8
11 65 16
12 81 16
13 97 16
14 113 16
15 129 16

You might also like