edited by
3,086 views
7 votes
7 votes
A Full Binary Tree is a binary tree where every node has either 0 or 2 children.

what i know
with Preorder and Inorder , Inorder and Postorder  and Inorder and Level-order ,we can have unique tree.

we can not have unique tree with following

Postorder and Preorder.
Preorder and Level-order.
Postorder and Level-order.
edited by

2 Answers

9 votes
9 votes

Answer : Yes, we can uniquely construct a Full binary tree from its Pre-order and Post-order traversals. 

A Full binary tree is a tree in which every node has either 0 or 2 children. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible. A perfect binary tree is a binary tree in which all interior nodes have two children and all leaves have the same depth or same level.

If we are given pre-order and post-order traversal of a Full binary tree, then we can always construct that binary tree uniquely from given pre-order and post-order traversal. 
If we are given pre-order and post-order traversal of a complete binary tree, then we can always construct that binary tree uniquely from given pre-order and post-order traversal. 
If we are given only pre-order  traversal of a perfect binary tree, then we can always construct that binary tree uniquely from given pre-order and post-order traversal. 

In general, if a node has only one subtree(left subtree or right subtree), then the pre-order and post-order traversals do not give you enough information to determine which side the subtree goes on. Hence, for full binary tree, perfect binary tree (which is also full binary tree), No node has only one subtree. And for Complete binary tree, we know that left subtree must occur before right subtree in the second last level. 

Moreover, For complete binary tree and Perfect binary tree, You don't even need both pre-order and post-order traversals. Either of pre-order or post-order traversals is enough to uniquely construct them. This is due to the fact that for any number of nodes, these trees have fixed/unique un-labeled structure. 

Related questions