Tower of Recursion 递归之塔
Move all disks from the left pillar to the right. No larger disk may rest on a smaller one.
把所有盘子从左柱移到右柱。大盘不能放在小盘之上。
Moves / 步数
0
Minimum / 理论最少
7
Disks / 盘子
3
Start / 起
Spare / 备
End / 终
Click a peg to pick up its top disk, then click another peg to place it.
点击柱子取走顶端的盘子,再点击另一根柱子放置。
Recursion / 递归:
To move n disks from source to target: (1) move n−1 disks from source to the spare peg, (2) move the nth (largest) disk from source to target, (3) move n−1 disks from spare to target. The minimum number of moves is 2ⁿ − 1. Each recursive call goes deeper into the call stack, then unwinds back.
要把 n 个盘子从源柱移到目标柱:(1) 把 n−1 个盘子从源柱移到备用柱,(2) 把第 n 个(最大的)盘子从源柱移到目标柱,(3) 把 n−1 个盘子从备用柱移到目标柱。最少步数为 2ⁿ − 1。每次递归调用深入调用栈,然后逐层返回。
要把 n 个盘子从源柱移到目标柱:(1) 把 n−1 个盘子从源柱移到备用柱,(2) 把第 n 个(最大的)盘子从源柱移到目标柱,(3) 把 n−1 个盘子从备用柱移到目标柱。最少步数为 2ⁿ − 1。每次递归调用深入调用栈,然后逐层返回。