Abstract

Binary tree traversal refers to the process of visiting each node in a specified order. There are two ways to visit a tree: recursively and non-recursively. Most references introduce tree traversal using recursion only. Our literature survey indicated that most references only show the implementations of the recursive algorithms, and only few references address the issue of nonrecursive algorithms. In this paper, we investigate and compare recursive and non-recursive algorithms for in-order, preorder, and post-order traversals. The in-order traversal of a binary search tree is important in searching algorithms, operating systems, and compiler design. In this paper we propose a new non-recursive algorithm for in-order binary search trees that is both efficient and easy to understand. The implementation of this new algorithm was done in Java and the complete algorithm was tested. The new algorithm was found to be faster than other nonrecursive algorithms.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call