TOWER OF HANOI

can anyone explain the algorithm for solving the tower of hanoi problem .. note : this algorithm should be implementable in the form of a computer program in c++ or java ...

14 Answers

11
Mani Pal Singh ·

4 more info refer

http://en.wikipedia.org/wiki/Tower_of_Hanoi

62
Lokesh Verma ·

Think in terms of reccurrsion..

not a tough problem...

1
ANKIT MAHATO ·

ok bhaiya .. i'll try to approach in recursion way ..

1
Philip Calvert ·

hey ankit wat do yu think i have done on my posts ? biotec ?

look carefully its completely comp Sc. in that post......

btw make programs only by urself....

if you strike upon a method purely by urself it remains embedded in u forever.......
of course ask but only if if its urgent REALLY URGENT

hehe of course im not a balmy the posts im referring to can be found on that TOWERS OF BRAHMA .. Q O D

62
Lokesh Verma ·

Well I said easy but it is not to be done right now

try it after boards... :)

1
ANKIT MAHATO ·

thanks Philip . i got that post ..

1
Philip Calvert ·

haha bhaiyya

wrong advice this time

guess why ??

1
ANKIT MAHATO ·

because it is one of the application of stack .. and it is there in boards ..

62
Lokesh Verma ·

I din give wrong advice intentionally ;)

If you know stack it is very easy .. but then i realised that you may not be very comfortable with them at the first place

1
ANKIT MAHATO ·

bhaiya stack is the only chapter i am not comfortable with .. thats why i was trying to find an alternative method ..

62
Lokesh Verma ·

stack not many people are comfortable with...

Arrays se this is possible but arrrays will breakdown due to size constraints

That is why we have stacks

But yeah I dont think there is another method! :(

If you use reccursion that is possible but even that is not easy at this stage.

1
Philip Calvert ·

[12] ankit i had no idea u were on to that stack thing

FOR STACK GO TO PRIYAMS PAGE.......ASK HIM THE address....
he has a program for TOH using stack in C++ (only i guessed)

and btw recursion makes this program wat ? sitter . curd .
ekdum halwa.

recursion is just the king if you can spot it in a particular problem...
and once u spot it in few ...... u'll start spotting it everywhere... maths physix chemistry...everywhere...

and once u start spotting recursion everywhere u can laugh at the problem........
only it makes it a bit heavy for the computer....but cheers [1][1]we're using wat Pentium 4 at least and anyways techniques such as DP are not in course

1
ANKIT MAHATO ·

ok bhaiyya and philip .. and all other people who gave in some time to this thread .. thankyou very much ... targetiit forum ROCKS !!

1
Philip Calvert ·

[6]

Your Answer

Close [X]