in DS edited by
7,633 views
17 votes
17 votes

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}$

in DS edited by
7.6k views

3 Answers

22 votes
22 votes
Best answer

The answer is A.

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
1 vote
Firstly we have to find Binary tree from inorder and preorder then we can find postorder

debfgca option A is right
1 vote
1 vote

Answer Is Option(A)

see the below explanation

by
Answer:

Related questions