检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:肖红德 XIAO Hong-de(School of Mathematics and Statistics,Henan University,Kaifeng475004,Chin)
机构地区:[1]河南大学数学与统计学院,河南开封475004
出 处:《软件导刊》2018年第8期118-120,共3页Software Guide
摘 要:汉诺塔问题是一个古典数学问题,对于给定的盘子数量及每步移动盘子次序是确定的。因此,只要能够确定盘子移动的规则,就可以通过计算机程序加以实现。递归算法虽然代码简单,但对于初学者而言,理解其内涵存在困难,且算法执行效率不高。提出一种基于非递归思想的移动方向判断算法解决汉诺塔问题,通过与递归算法执行时间比较,提出的判断移动方向算法执行效率更高,且算法思想相对更简单、更容易理解。The Hanoi tower problem is a classical mathematical problem.Since the order of moving plate at each step is fixed for agiven number of plates,the rules for moving plate can be readily determined by computer program.Although the code of recursive algorithm is simple,but for beginners,its meaning is not easy to understand,and the efficiency of its execution is not high.In this paper,we propose algorithm which is based on the non-recursive thinking and used to jude moving directions to solve the problem of the Hanoi tower.By comparing with the execution time of the recursive algorithm,we can draw a conclusion that judge the algorithm proposed in this paper is more efficient,and its algorithmic thinking is relatively simple,easier to understand.
关 键 词:汉诺塔问题 递归算法 非递归算法 移动规律 算法效率
分 类 号:TP312[自动化与计算机技术—计算机软件与理论]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.145