This paper presents a new non-recursive algorithm for reconstructing a binary tree from its traversals. Binary tree traversal refers to the process of visiting each node in a specified order. Given the in order traversal of a binary tree, along with one of its preorder or post order traversals, the original binary tree can be uniquely identified. This algorithm is efficient and requires O(n) time and O(n) space. The implementation of this algorithm was done in C and the complete algorithm was tested. The new algorithm was found to be faster than other non-recursive algorithms.
展开▼