Hanoi塔问题的一种非递归算法 |
| |
引用本文: | 刘振海,束长宝. Hanoi塔问题的一种非递归算法[J]. 电脑开发与应用, 2002, 15(11): 33-34,37 |
| |
作者姓名: | 刘振海 束长宝 |
| |
作者单位: | 1. 江苏邗江职业中专,邗江,225100 2. 扬州大学,扬州,225009 |
| |
摘 要: | 通过对 Hanoi塔问题的研究 ,给出了 Hanoi塔问题的非递归算法的思想和流程图 ,并用不允许递归调用的 BASIC语言实现了 Hanoi塔问题的非递归算法。该算法的优点在于可一次性求得总移动次数 ,但从程序结构看其编程思路较复杂 ,难于理解 ,算法的时间复杂性和空间复杂性与递归算法无异。
|
关 键 词: | Hanoi塔 非递归算法 程序设计 算法实现 时间复杂性 空间复杂性 |
A Non-recursion Algorithm about Tower of Hanoi |
| |
Abstract: | 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. |
| |
Keywords: | Hanoi tower nonrecursive algorithm programming algorithm implementation time complexity spatial complexity |
本文献已被 CNKI 维普 万方数据 等数据库收录! |
|