+ 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..

12th Sep 2018, 4:43 PM
Prajakta
Prajakta - avatar
10 Respostas
+ 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
13th Sep 2018, 2:33 PM
John Wells
John Wells - avatar
+ 8
Bebida Roja no it is an application of LIFO buffer... i.e. it follows the last in first out method..
13th Sep 2018, 7:55 AM
Prajakta
Prajakta - avatar
+ 6
John Wells Oo thanks thank you so much.. I got my answer
13th Sep 2018, 2:40 PM
Prajakta
Prajakta - avatar
+ 5
21st Sep 2018, 1:36 PM
Prajakta
Prajakta - avatar
+ 4
John Wells Yes Sure.. but can you give me sample code to implement this..
13th Sep 2018, 7:58 AM
Prajakta
Prajakta - avatar
+ 4
hinanawi yes you are right... but it is given as an application of Stack in the syllabus of Data Structures for diploma students...
13th Sep 2018, 8:00 AM
Prajakta
Prajakta - avatar
+ 3
You could use a stack to support the rings on the pins. I did for my challenge code.
12th Sep 2018, 7:19 PM
John Wells
John Wells - avatar
+ 1
tower of hanoi is usually solved using recursion, not stacks
12th Sep 2018, 4:55 PM
hinanawi
hinanawi - avatar