摘要
作者对Hanoi塔问题现有的五种递归算法和非递归算法进行了时间测试,发现现有的非递归算法随着盘子数n的增大,在时间效率上不如递归算法,在空间效率上的优势也不明显.作者采用编码的方法提出了一种新的非递归算法.本算法在时间效率上较大地优于现有的非递归算法,也明显地优于递归算法.并且可以根据需要,增大编码的重数,从而使时间效率成倍提高.
Present five solutions to Hanoi tower problem and calculates their running time have studied and compared in this paper. It is discovered that as n increases, the four non-recursire algorithms of papers cost much more time than the recursire algorithm. This paper proposes a new non-recursive algorithm which bases on coding. This new algorithm will cost less time than the present non-recursive algorithms and also the recursive algorithm. Furthermore, you can code many times and the time cost can be reduced consequently.
出处
《中国计量学院学报》
2005年第3期212-217,共6页
Journal of China Jiliang University
关键词
HANOI塔
非递归算法
递归算法
编码
时间效率
Hanoi tower
non-recursion algorithm
recursion algorithm
coding
time efficiency