Unit III - Tower of Hanoi
Unit III - Tower of Hanoi
Tower of Hanoi
• Tower of Hanoi, is a mathematical puzzle which consists of three
towers (pegs) and more than one rings is as depicted −
IF disk == 1, THEN
move disk from source to dest
ELSE
Hanoi(disk - 1, source, temp, dest) // Step 1
move disk from source to dest // Step 2
Hanoi(disk - 1, temp, dest, source) // Step 3
END IF
END Procedure
STOP