文件名称:hannuota
- 所属分类:
- 数据结构常用算法
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 356kb
- 下载次数:
- 0次
- 提 供 者:
- hua****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
算法思路:
1.如果只有一个金片,则把该金片从源移动到目标棒,结束。
2.如果有n个金片,则把前n-1个金片移动到辅助的棒,然后把自己移动到目标棒,最后再把前n-1个移动到目标棒.
3.单纯对于有N个金片要挪动的步数求出, 可以使用递推方法,满足递推方程f(i) = f(i - 1) * 2 + 1-Algorithm idea: 1. If there is only a gold film, while the gold from the source to the target mobile wand, The End. 2. If there are n gold films, while the former n-1 gold piece to move to the auxiliary rod, and then move to the goal of their own stick, then the last n-1 before moving to the target rod. 3. Simply to have N a gold piece to move step calculated, you can use recursive methods to meet the recursive equation f (i) = f (i- 1)* 2+ 1
1.如果只有一个金片,则把该金片从源移动到目标棒,结束。
2.如果有n个金片,则把前n-1个金片移动到辅助的棒,然后把自己移动到目标棒,最后再把前n-1个移动到目标棒.
3.单纯对于有N个金片要挪动的步数求出, 可以使用递推方法,满足递推方程f(i) = f(i - 1) * 2 + 1-Algorithm idea: 1. If there is only a gold film, while the gold from the source to the target mobile wand, The End. 2. If there are n gold films, while the former n-1 gold piece to move to the auxiliary rod, and then move to the goal of their own stick, then the last n-1 before moving to the target rod. 3. Simply to have N a gold piece to move step calculated, you can use recursive methods to meet the recursive equation f (i) = f (i- 1)* 2+ 1
(系统自动生成,下载前可以参看下载内容)
下载文件列表
汉诺塔
......\Debug
......\汉诺塔.cpp
......\汉诺塔.dsp
......\汉诺塔.dsw
......\汉诺塔.ncb
......\汉诺塔.opt
......\汉诺塔.plg
......\Debug
......\汉诺塔.cpp
......\汉诺塔.dsp
......\汉诺塔.dsw
......\汉诺塔.ncb
......\汉诺塔.opt
......\汉诺塔.plg