Tower of Hanoi is a very famous game. In this game there are 3 pegs and N number of disks placed one over the other in decreasing size. The objective of this game is to move the disks one by one from the first peg to the last peg. And there is only ONE condition, we can not place a bigger disk on top of a smaller disk.
If you are interested in solving the game, then download the FREE Tower Of Hanoi game from goo.gl/K0A6QC
In this video we will learn to solve Tower Of Hanoi recursively by taking minimum number of moves.
About Tower Of Hanoi
Important rule to follow while solving Tower Of Hanoi
The three pegs of Tower Of Hanoi labeled A, B and C
The 3 disks in decreasing size from bottom to top
Objective of the game
How to solve Tower Of Hanoi
The general notation used to solve the Tower Of Hanoi problem recursively
The 3 steps to follow recursively to solve Tower Of Hanoi
Solving the game with 3 disks
Calculating the minimum number of moves to solve Tower Of Hanoi recursively
Solving T(3, A, B, C)
Solving T(2, A, C, B)
Solving T(2, B, A, C)
So we have the moves. Lets see them in action!
Algorithm of Tower Of Hanoi (Recursive)
Calculating minimum number of moves to solve Tower Of Hanoi having N disks
You can download the code from my GitHub repository
To know more about Pseudo code kindly watch this video