Number of moves to solve the hanoi towers puzzle
The minimum number of steps required to move n disks from source to dest is quite intuitive from the time complexity analysis and also from the raw examples as shown in the table, Hence, the time complexity of the recursive solution of Tower of Hanoi is O(2n) which is exponential. $$TowerofHanoi(n, source, dest, aux) = \text-1$ Hence, the recursive solution for Tower of Hanoi having n disks can be written as follows,
![number of moves to solve the hanoi towers puzzle number of moves to solve the hanoi towers puzzle](http://javaonlineguide.net/wp-content/uploads/2014/09/towers-of-hanoi-output.png)
(again move all (n-1) disks from aux to dest.
![number of moves to solve the hanoi towers puzzle number of moves to solve the hanoi towers puzzle](https://i.pinimg.com/originals/f3/53/bd/f353bdbd8c272e33f0af89a20e439d9e.png)
You can move only one disk at a time from the top of any tower.The task is to move all the disks from one tower, say source tower, to another tower, say dest tower, while following the below rules, Here’s what the tower of Hanoi looks for n=3, nth disk at the bottom and 1st disk at the top. These disks are stacked over one other on one of the towers in descending order of their size from bottom i.e. Tower of Hanoi is a mathematical puzzle which consists of three towers(or pegs) and n disks of different sizes, numbered from 1, the smallest disk, to n, the largest disk.