International Journal of Computer Applications |
Foundation of Computer Science (FCS), NY, USA |
Volume 43 - Number 10 |
Year of Publication: 2012 |
Authors: Nitin Arora, Vivek Kumar Tamta, Suresh Kumar |
10.5120/6141-8386 |
Nitin Arora, Vivek Kumar Tamta, Suresh Kumar . Modified Non-Recursive Algorithm for Reconstructing a Binary Tree. International Journal of Computer Applications. 43, 10 ( April 2012), 25-28. DOI=10.5120/6141-8386
Binary tree traversal refers to the process of visiting each node in a specified order. Given the inorder traversal of a binary tree, along with one of its preorder or postorder traversals, the original binary tree can be uniquely identified. Many recursive and non recursive method of construction of the tree from inorder and any of the postorder or preorder traversal have been proposed. In this paper one of the proposed algorithms has been examined. This algorithm computes the wrong tree for some input sequences. We show a particular situation in which the algorithm fails and a solution for this situation is proposed. The proposed a modified non-recursive algorithm for reconstructing a binary tree which generates the correct tree otherwise an error has been reported.