Towers of Hanoi is more than a century old mathematical puzzle (1983 to be precise). It consists of 3 rods (pegs), and n disks (n>=1) of different sizes which can slide onto any rod.Lets mark the pegs as S, D & E for Source, Destination and Extra. Initially all the disks are in the S as shown below:
Our task is to move the entire Stack of Disks from Source, S to Destination, D using the extra peg, E. So the final state should be
But, there are some rules of the game to be obeyed:
- Only one disk can be moved at a time.
- Only the topmost disk can be moved (from any peg).
- A bigger disk cannot be placed on the top of a smaller disk ever in the game.
No comments:
Post a Comment