汉诺塔(Tower of Hanoi)问题是求在三个柱子之间移动圆盘的方法,它是递归程序设计的经典例子,已经证明其时间复杂度下限是O(2n),空间复杂度是O(n),实际使用时很容易溢出。给出汉诺塔问题的两个非递归算法:解集递推法和解集树法。解集递...汉诺塔(Tower of Hanoi)问题是求在三个柱子之间移动圆盘的方法,它是递归程序设计的经典例子,已经证明其时间复杂度下限是O(2n),空间复杂度是O(n),实际使用时很容易溢出。给出汉诺塔问题的两个非递归算法:解集递推法和解集树法。解集递推法的时间复杂度和空间复杂度都是O(2n),该算法空间复杂度很大,无法实际使用,提出该算法的目的是为了引出解集树法。解集树法可以计算出指定的任意一步移动方法,时间复杂度和空间复杂度分别是O(n*2n)和O(1)。并证明了汉诺塔问题的空间复杂度下限是O(1)。展开更多
The method of transforming a recursive algorithm into non-recusive algorithm is discussed in this paper, which is based on the typical questions: Fibonacci series, Ackermann-functuin, Hanoi tower problem and Traversin...The method of transforming a recursive algorithm into non-recusive algorithm is discussed in this paper, which is based on the typical questions: Fibonacci series, Ackermann-functuin, Hanoi tower problem and Traversing binary tree etc. in the same time ,the characteristics and executing efficiency of recursive algorithm and non-recursive algothm are also discussed.展开更多
文摘汉诺塔(Tower of Hanoi)问题是求在三个柱子之间移动圆盘的方法,它是递归程序设计的经典例子,已经证明其时间复杂度下限是O(2n),空间复杂度是O(n),实际使用时很容易溢出。给出汉诺塔问题的两个非递归算法:解集递推法和解集树法。解集递推法的时间复杂度和空间复杂度都是O(2n),该算法空间复杂度很大,无法实际使用,提出该算法的目的是为了引出解集树法。解集树法可以计算出指定的任意一步移动方法,时间复杂度和空间复杂度分别是O(n*2n)和O(1)。并证明了汉诺塔问题的空间复杂度下限是O(1)。
文摘The method of transforming a recursive algorithm into non-recusive algorithm is discussed in this paper, which is based on the typical questions: Fibonacci series, Ackermann-functuin, Hanoi tower problem and Traversing binary tree etc. in the same time ,the characteristics and executing efficiency of recursive algorithm and non-recursive algothm are also discussed.