Design an algorithm using stacks.
We have to move 64 disks from one pole to another. But there are some rules about how this should be done, which are:
We have to move 64 disks from one pole to another. But there are some rules about how this should be done, which are:
- You can move only one disk at a time.
- For temporary storage, a third pole may be used.
- You cannot place a disk of larger diameter on a disk of smaller diameter
Theory:
Recursive:
Iterative:
No comments:
Post a Comment