Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Tower of Hanoi. 11 21 11231123 31 112337112337.

Similar presentations


Presentation on theme: "The Tower of Hanoi. 11 21 11231123 31 112337112337."— Presentation transcript:

1 The Tower of Hanoi

2 11

3 21 11231123

4 31 112337112337

5 41 23 37 415 7+8=15

6 1 23 37 415 531 663 7127 8255 2 4 8 16 32 64 128 256 DATA2n2n x n =2 n -1 If x= min number of moves:

7 Recursion Assume the formula for the minimum number of moves to achieve the goal is: X n =2 n -1 for all values up to n Prove true for X n+1 X n+1 =X n +1+X n =(2 n -1)+1+(2 n -1) =2(2 n -1)+1 =2 n+1 -1 Proof By Induction

8 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. Bicolor Variation

9 Multiple Post Variations With more posts, transferring the disks should require fewer moves.

10 nt=4Increase 11 232 352 494 5134 6174 7258 8338 9418 10498 116516 128116 139716 1411316 1512916 Here is some data we came across regarding the minimum number of moves required to transfer n disks to another post:


Download ppt "The Tower of Hanoi. 11 21 11231123 31 112337112337."

Similar presentations


Ads by Google