Tower of Honai: The tower of Hanoi was invented by a French mathematician Édouard Lucas in the 19th century.
A Tower of Honai is simply a game problem. It is based on three pegs i.e source, middle and destination and a set of a disk of the different sizes.
Each disk has a hole in the centre so that it can be stacked on any of the pegs. Here we have to see how we can use recursion to produce a logical solution.
Recursion is a technique of defining anything in terms of itself. Recursion is mainly use in terms of game development.
Then, the number of steps=2^n-1
Here,n is the number of the disk. The main aim is the movement of the disk. So,the rules for the movement of the disk are:
1. Only one disc can be moved at a time.
2.Each disk must be stacked on any one of the pegs.
3.Transferring the disk from the source peg to the destination peg such that at any point of transformation no lager size disk is placed on the smaller one.
Algorithm for Tower of Hanoi:
- Move the top n-1 disk from source peg to middle peg.
- Move the bottom most peg nth disk of source peg to destination peg.
- Move n-1 disk stacked on middle peg to destination peg.
Application of Tower of Hanoi
- It is frequently used in the psychological research of problem-solving.
- It is used in the neuropsychological diagnosis and treatment of the executive functions.
- It is also used to teach the recursive algorithm for the beginners of the programming student.
Tower of Hanoi is common dynamic programming which is used in the various programming challenges.
January 21 @ 10:00 am - January 25 @ 5:00 pm
NEPAL7 days ago
Now common mistake will be accepted in License Trail
EVENTS7 days ago
KU HackFest 2021 Prize Announced. Know what will you get if you win.
OPINION7 days ago
Messaging app signal is getting popularity all of sudden. Why this is happening right now?
How To6 days ago
How to turn on Edge Lighting on an Android Device?
NEPAL4 days ago
Nagarik App: Nepal Government launches app to provide government services through a single platform!
esewa6 days ago
You can Now Load Fund or Make Transactions via eSewa by Linking Your Bank Account
News7 days ago
Donald Trump permanently banned on Snapchat too!
Entertainment7 days ago
Korean Drama in Nepali Language. Watch on DishHome