# tower of hanoi

What is the algorithm for depth-first search for tower of hanoi!
###### Who is Participating?

Commented:
I'll send you the algorithm by e-mail today.
My e-mail is slv@writeme.com
0

Commented:
Is this a school assignment>
0

Commented:
..
0

Commented:
Looks like it doesn't it.
Can you be a bit more precise? We don't want to make your homework, but we can help with problems you encounter while making the assignment.
0

Commented:
the graph describe the search:
(n,0,0)
|     \
(n-1,1,0)  (n-1,0,1)
|    \         |      \
(n-2,1,1) (n-1,0,1)(n-1,1,0) (n-2,1,1)
....................
the algorithm will look like:
move_tower(a,b,c)
{
check feasible placement,then choose one;
move_piece(1,a,b or c);//move one piece from a to b or c;
if(succeed()) return;
move_tower(a b c);
}
You need to add depth limit to the recursive calls,and to record its status so not to do the non-stop calling.Then the second level's second status,won't appear ,for it is the same as the third level's second status.
Perhaps it's wrong.
0

Author Commented:
Thanks a lot
But how can i perform the backtrack
(check the moved pattern existed in its ancester or not)
(All node in the path of the tree should be unique)

Thank you

Fannie
0

Commented:
See
http://www.pangea.ca/kolar/javascript/Hanoi/HTonWebE.html
for links to web resources and(for example)
http://www.pangea.ca/kolar/javascript/Hanoi/algo.html
for fast non recursive algorithm(+source
text)
Alex
0

Author Commented:

Anyway, thanks to all of you
0

Commented:
Is there are reason why you can't post the solution here?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.