hanoi(3, A, B, C)=> hanoi(2, A, C, B)=> hanoi(1, A, B, C) =>move(1, A, C) move(A, B) hanoi(1, C, A, B) =>move(C, B) move(A, C) hanoi(2, B, A, C)=> hanoi(1, B, C, A)=> move(1, B, A) move(B, C) hanoi(1, A, B, C)=> move(1, A, C)
追问move(1,a,c)之后是怎么变到hanoi(1,c,a,b)的呀
追答都是根据你贴的代码啊 hanoi(2, A, C, B) 展开后就是 hanoi(1, A, B, C) move(A, B) hanoi(1, C, A, B)