(43 Views)

Tower of Hanoi, is a mathematical puzzle which consists of three towers.These rings are of varying sizes sizes and stacked upon each other in ascending order. There are other variations of the puzzle where the number of disks increase, but the tower count remains the same.

A few rules that need to be followed for Tower of Hanoi are -

1.The top disk can be moved only. 2.Only one disk can be moved at a time. 3.No large disk sits above a small disk.

In the above algorithm,

- Consider three towers source, dest, aux and take value of disks from the user.
- Now we move all the above n-1 disks one by one from source to aux.
- The largest disk is left at the source, which is then moved to the dest tower.
- Then again the rest of the disks are moved back from aux to source.
- Again the same steps are repeated so that all the disks are moved to the dest tower.

0 UpvotesUpvote |
0 DownvotesDownvote |

- Add a column with a default value to a table in Oracle SQL [308 Views]
- Flowchart and Algorithm for Converting Infix to Postfix notation [215 Views]
- Pseudocode and Algorithm to find Largest of 2 numbers [370 Views]
- Find HCF and LCM using Python [695 Views]
- Download Machine Learning by Tom Mitchell PDF [881 Views]

- Knuth-Morris-Pratt (KMP) Substring Search Algorithm with Java Example [10126 Views]
- Algorithm to find whether number is Armstrong Number or Not [9474 Views]
- How To Win Ludo King Game Every Time [9415 Views]
- error: Multiple commands produce error in Xcode 10 [5659 Views]
- FlowChart and Algorithm to find Whether a Number is Even or Odd [5123 Views]