摘要
通过对 Hanoi塔问题的研究 ,给出了 Hanoi塔问题的非递归算法的思想和流程图 ,并用不允许递归调用的 BASIC语言实现了 Hanoi塔问题的非递归算法。该算法的优点在于可一次性求得总移动次数 ,但从程序结构看其编程思路较复杂 ,难于理解 ,算法的时间复杂性和空间复杂性与递归算法无异。
This paper presents the idea and flowchart of nonrecursion algorithm of Hanoi tower after researching the Hanoi tower issue,and implements the nonrecursion algorithm with BASIC language that is allowable for recursive call.This method has an advantage of obtaining total number of moving one time,but has a more complex programming idea from the architecture and harder understanding.There is not any difference from recursive algorithm in time complexity and spatial complexity.
出处
《电脑开发与应用》
2002年第11期33-34,37,共3页
Computer Development & Applications
关键词
HANOI塔问题
非递归算法
时间复杂性
空间复杂性
计算机算法
Hanoi tower,nonrecursive algorithm,programming,algorithm implementation,time complexity,spatial complexity