+ 12

# Is the Tower of Hanoi is an application of stack?

Is The tower of Hanoi is an application of Stack? If your answer is yes then give the code for 5 disks using 3 rods..

8 Réponses

+ 5

Prajakta there are plenty of finished codes linked to the challenge. Just make sure you code your own after seeing how they did it. I'd suggest reading ones in a different language from what your code will be in to prevent yourself from stealing the answer.
https://www.sololearn.com/learn/662

+ 8

Bebida Roja no it is an application of LIFO buffer... i.e. it follows the last in first out method..

+ 6

John Wells Oo thanks thank you so much..
I got my answer

+ 5

Premchandra Singh Nice code

+ 4

John Wells Yes Sure..
but can you give me sample code to implement this..

+ 4

hinanawi yes you are right...
but it is given as an application of Stack in the syllabus of Data Structures for diploma students...

+ 3

You could use a stack to support the rings on the pins. I did for my challenge code.

+ 1

tower of hanoi is usually solved using recursion, not stacks