Professional Documents
Culture Documents
Exercise 2
Exercise 2
Disc 2
Disc 3
STEP 1 DISC 1
STEP 2 DISC 2
STEP 3 DISC 1
STEP 4 DISC 3
STEP 5 DISC 1
STEP 6 DISC 2
STEP 7 DISC 1
Steps in solving the Tower of Hanoi (4 Discs):
1. Move Disk 1 to Rod 2 9. Move Disk 1 to Rod 3
2. Move Disk 2 to Rod 3 10. Move Disk 2 to Rod 1
3. Move Disk 1 to Rod 3 11. Move Disk 1 to Rod 1
4. Move Disk 3 to Rod 2 12. Move Disk 3 to Rod 3
5. Move Disk 1 to Rod 1 13. Move Disk 1 to Rod 2
6. Move Disk 2 to Rod 2 14. Move Disk 2 to Rod 3
7. Move Disk 1 to Rod 2 15. Move Disk 1 to Rod 3
8. Move Disk 3 to Rod 3
In solving the Tower of Hanoi in 4-disc, it takes 15 moves to reach rod 3 or the
destination.
It has a recursive pattern where it uses information from one step to find another,
likewise in moving the n disks from rod A to C.
The number of moves of needed to transfer n disks from rod A to C is 2M + 1 where
M is the number ofmoves needed to transfer n disk.
For 4 disk, it will take 15 moves : 2M + 1 = 2(7) + 1 = 15 *(7 came from the number
of steps needed in disc 3)
Likewise, the powers fo two can help reveal the pattern : 24 – 1
So the formula that we can use for getting the number of steps is 2n – 1.