实验科学与技术2016,Vol.14Issue(1):51-54,81,5.DOI:10.3969/j.issn.1672-4550.2016.01.016
自底向上记录式 Hanoi 塔非递归算法
Non -Recursive Algorithm Based on Down -Up Record Method for Hanoi Tower
摘要
Abstract
The code of classical recursion algorithm for Hanoi tower problem is simple,but the time complexity is O(2n )and the code is difficult to understand.Understanding recursive idea of Hanoi tower problem and constructing a tree model based on the func-tion,two objectives of the function’s parameters and the execution result are analyzed carefully.Then the relationship between them is obtained and used to design a new down -up non -recursive algorithm.This algorithm here records the moving paths of n plates (n =1,2,…),which could be applied to get the moving result of n +1 plates directly.The experimental results show that the correspond-ing code is very easy to read,and its time complexity is only O(n),which is further practice and study for the non -recursive re-search of Hanoi tower problem.关键词
Hanoi 塔问题/自底向上记录式/非递归算法/目标柱Key words
Hanoi tower problem/down -up record/non -recursive algorithm/Visual Basic分类
信息技术与安全科学引用本文复制引用
戴莉萍,黄龙军,刘清华..自底向上记录式 Hanoi 塔非递归算法[J].实验科学与技术,2016,14(1):51-54,81,5.基金项目
江西省自然科学基金项目(20132BAB201031)。 ()