Title :
Nonrecursive algorithms for reconstructing a binary tree from its traversals
Author :
Chen, G.H. ; Yu, M.S. ; Liu, L.T.
Author_Institution :
Dept. of Comput. Sci. & Inf. Eng., Nat. Taiwan Univ., Taipei, Taiwan
Abstract :
The authors propose two nonrecursive algorithms for reconstructing the original binary tree from its inorder and preorder traversals. The proposed algorithms proceed in two stages: the first stage establishes the i-p sequence while the second stage reconstructs the binary tree from the i-p sequence. One algorithm, which requires O(N) time, is time-optimal but space-inefficient, while the other requires O(N log N) time and O(N) space. If sorting and binary search are used, then the space required is optimal within a constant factor. If, instead, hashing is used, the computation time required is optimal within a constant factor. Simple modifications of the proposed algorithm can be used to reconstruct the original binary tree from its inorder and postorder traversals.<>
Keywords :
algorithm theory; computational complexity; trees (mathematics); binary search; binary tree; computation time; i-p sequence; inorder; nonrecursive algorithms; preorder; sorting; space-inefficient; time-optimal; traversals; Acceleration; Binary trees; Computer science; Reconstruction algorithms;
Conference_Titel :
Computer Software and Applications Conference, 1988. COMPSAC 88. Proceedings., Twelfth International
Conference_Location :
Chicago, IL, USA
Print_ISBN :
0-8186-0873-0
DOI :
10.1109/CMPSAC.1988.17225