Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Daryl Q.

Pansoy BSCE1 – M3

Tower of Hanoi
Objective
To move disk n from source to destination and then put all other (n1) disks onto it. 

THREE DISKS
Assuming that the Tower of Hanoi puzzle with n disks can be solved in minimum 2n−1 steps.
Let n = 3
= 2n – 1
= 23 – 1 
=8–1
= 7 is the minimum moves to solve the puzzle if there are three disks.

Disk 1 – Small Disk A – left side


Disk 2 – Medium Disk B - middle
Disk 3 – Large Disk C – right side

Procedures

Step 1: Disk 1 moved from A to C


Step 2: Disk 2 moved from A to B

Step 3: Disk 1 moved from C to B

Step 4: Disk 3 moved from A to C

Step 5: Disk 1 moved from B to A


Step 6: Disk 2 moved from B to C

Step 7: Disk 1 moved from A to C

Therefore, in the end, the Tower of Hanoi can be solved with a minimum of seven steps if
there are three disks given.

FOUR DISKS
Assuming that the Tower of Hanoi puzzle with n disks can be solved in minimum 2n−1 steps.
Let n = 4
= 2n – 1
= 24 – 1 
= 16 – 1
= 15 is the minimum moves to solve the puzzle if there are three disks.
Disk 1 – Small Disk Disk 4 – Large Disk A – left side
Disk 2 – Medium Disk B - middle
Disk 3 – Large Disk C – right side
Procedures

Step 1: Move disk 1 from A to B

Step 2: Move disk 2 from A to C

Step 3: Move disk 1 from B to C


Step 4: Move disk 3 from A to B

Step 5: Move disk 1 from C to A

Step 6: Move disk 2 from C to B

Step 7: Move disk 1 from A to B


Step 8: Move disk 4 from A to C

Step 9: Move disk 1 from B to C

Step 10: Move disk 2 from B to A

Step 11: Move disk 1 from C to A


Step 12: Move disk 3 from B to C

Step 13: Move disk 1 from A to B

Step 14: Move disk 2 from A to C

Step 15: Move disk 1 from B to C

Therefore, in the end, the Tower of Hanoi can be solved with a minimum of 15 steps if
there are four disks given.

You might also like