提出一种新的由一棵严格二叉树的先序序列和结点的左孩子情况构造该严格二叉树的非递归算法.通过实例给出了新算法的执行过程,同时说明,与已有的等价递归算法相比,新算法的时间复杂性更低,而最差情况空间复杂性相同.
A new non-recursive algorithm is presented for constructing a strictly binary tree from its preorder traversal and the left child of each node. The execution of the new algorithm is illustrated by an example. Let n be the number of nodes of a strictly binary tree. The time complexity of the new algorithm is O(n), and it is lower than that of the equivalent recursive algorithm. The worst case space complexity of the new algorithm is 0 (n), and it is the same as that of the equivalent recursive algorithm.