993 views

The inorder and preorder traversal of a binary tree are

$\text{d b e a f c g}$ and $\text{a b d e c f g}$, respectively

The postorder traversal of the binary tree is:

1. $\text{d e b f g c a}$

2. $\text{e d b g f c a}$

3. $\text{e d b f g c a}$

4. $\text{d e f g b c a}$

retagged | 993 views

Take the first node in preorder traversal - a will be the root of the tree
All nodes to the left of '$a$' in inorder traversal will be in the left subtree of '$a$' and all elements on the right will be in the right subtree of '$a$'.
Take the second element from preorder traversal - '$b$' - goes to left subtree of '$a$' as it is in the left of '$a$' in inorder list.
Proceeding likewise we can construct the binary tree as:

edited by
+1 vote
Firstly we have to find Binary tree from inorder and preorder then we can find postorder

debfgca option A is right

1
2