Open In App

If you are given two traversal sequences, can you construct the binary tree?

It depends on what traversals are given. If one of the traversal methods is Inorder then the tree can be constructed, otherwise not.

   



Therefore, following combination can uniquely identify a tree.

And following do not. 



For example, Preorder, Level-order and Postorder traversals are same for the trees given in above diagram. 

So, even if three of them (Pre, Post and Level) are given, the tree can not be constructed.

Article Tags :