若在main函数中调用hanoi(3,'A','B','c')运行结果
void move(char getone,char putone)
{printf("%c-->%c\n",getone,putone);
}
void hanoi(int n,char one, char two,char three)
{if(n==1)move(one,three);
else
{ hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}
}
结果是:
A-->C
A-->B
C-->B
A-->C
B-->A
B-->C
A-->C
这个是怎么得到的啊,递归的头都晕了,能不能帮忙把过程写出来,越清楚越好!!!!