A novel algorithm to determine the leaf (leaves) of a binary tree from its preorder and postorder traversals

07/01/2020
by   Peyman Nasehpour, Ph.D., et al.
0

Binary trees are essential structures in Computer Science. The leaf (leaves) of a binary tree is one of the most significant aspects of it. In this study, we prove that the order of a leaf (leaves) of a binary tree is the same in the main tree traversals; preorder, inorder, and postorder. Then, we prove that given the preorder and postorder traversals of a binary tree, the leaf (leaves) of a binary tree can be determined. We present the algorithm BT-leaf, a novel one, to detect the leaf (leaves) of a binary tree from its preorder and postorder traversals in quadratic time and linear space.

READ FULL TEXT

Please sign up or login with your details

Forgot password? Click here to reset