300,158 views 214 on YTPak
1,145 219

Published on 03 Mar 2014 | over 4 years ago

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.

Tutorial and Code: www.dyclassroom.com/recursion-algorithm/tower-of-hanoi

In this video we will learn to solve Tower Of Hanoi recursively by taking minimum number of moves.

0:03 About Tower Of Hanoi
0:18 Important rule to follow while solving Tower Of Hanoi
0:25 The three pegs of Tower Of Hanoi labeled A, B and C
0:33 The 3 disks in decreasing size from bottom to top
0:38 Objective of the game
0:51 How to solve Tower Of Hanoi
0:58 The general notation used to solve the Tower Of Hanoi problem recursively
1:15 The 3 steps to follow recursively to solve Tower Of Hanoi
1:50 Solving the game with 3 disks
2:05 Calculating the minimum number of moves to solve Tower Of Hanoi recursively
2:10 Solving T(3, A, B, C)
3:05 Solving T(2, A, C, B)
3:58 Solving T(2, B, A, C)
4:55 So we have the moves. Lets see them in action!
6:10 Solved!
6:15 Algorithm of Tower Of Hanoi (Recursive)
6:42 Calculating minimum number of moves to solve Tower Of Hanoi having N disks

Related Videos
Factorial www.youtube.com/watch
Fibonacci www.youtube.com/watch

You can download the code from my GitHub repository

To know more about Pseudo code kindly watch this video

Thanks :-)
Customize Your Hybrid Embed Video Player!

6-digit hexadecimal color code without # symbol.


Report video function is under development.


Loading related videos...