*Tower of Hanoi*
consists of three pegs or towers with n disks placed one over the other. The objective of the puzzle is to move the stack to another peg following these simple rules. Only one disk can be moved at a time. No disk can be placed on top of the smaller disk.
*How many moves is required to move the eight dices as shown?*
*河内之塔*
由三个柱子组成,
有 n 个大小不一的圆盘堆叠成塔,大的放在小的之上。
目标是按照这些简单的规则将圆盘移动到另一个柱子上。
一次只能移动一个圆盘。
任何圆盘都不能放置在较小圆盘的上面。
如图所示
*移动八个圆盘需要多少个步骤呢?*
*Tower of Hanoi*
*Mathematical Recursion*
no of
disks. no of moves
1. 1. 1
2. 3. 1+1+1. 1+2
3. 7. 3+1+3. 1+2+2^2
4. 15. 7+1+7. 1+2+2^2+2^3
n. Fn. 2F(n-1)+1
Fn=1+2+2^2+2^3+.. +2^(n-1)
2Fn=2+2^2+2^3+.... +2^n
Fn=2^n-1
*请问 若是有64个圆盘;需要多长的时间完成?*😀😀😀
No comments:
Post a Comment