A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

How Recursion works in Tower of Hanoi program ?

Best Answers

Question is, You have given a 3 Peg (Start peg, Auxiliary/helper peg and End Peg) Start peg contains 3 disks of different sizes as shown. You have to move all the disk from Start peg to End peg using Auxiliary peg. read more

In our Towers of Hanoi problem, If there is more then 2 disk, then do recursive call on the disk until only one disk is remaining. Keep Tower of Hanoi recursion stack trace in mind and it will be really easy to code. read more

This C Program uses recursive function & solves the tower of hanoi. The tower of hanoi is a mathematical puzzle. It consists of threerods, and a number of disks of different sizes which can slideonto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top. read more

In our Towers of Hanoi solution, we recurse on the largest disk to be moved. That is, we will write a recursive function that takes as a parameter the disk that is the largest disk in the tower we want to move. read more

Encyclopedia Research

Related Types