retagged by
4,937 views
4 votes
4 votes

Given a binary tree whose inorder and preorder traversal are given by

Inorder : EICFBGDJHK

Preorder : BCEIFDGHJK

The post order traversal of the above binary tree is

  1. I E F C G J K H D B
  2. I E F C J G K H D B
  3. I E F C G K J H D B
  4. I E F C G J K D B H
retagged by

2 Answers

Best answer
3 votes
3 votes

Preorder - BCEIFDGHJK means root node is B. Inorder - EICFBGDJHK

So search for B in Inorder traversal. Everything to the left of B is left subtree and to the right of B is right subtree in inorder traversal. So we understand that EICF forms the left subtree and GDJHK forms the right subtree of B.

Repeating, this for EICF, we find that C is the root and EI (or IE) forms the left subtree and F forms the right subtree of C. Similarly, for GDJHK, D is the root. G is the left subtree and JHK (or JKH) forms the right subtree.

Therefore, we have the tree as drawn below:

Now finding postorder is very easy. The answer is option (A) IEFCGJKHDB

selected by

Related questions

3 votes
3 votes
2 answers
1
makhdoom ghaya asked Aug 23, 2016
3,126 views
The number of different trees with $8$ nodes is256255248None of these
0 votes
0 votes
2 answers
2
makhdoom ghaya asked Aug 30, 2016
2,290 views
Which is the most valuable electronic commerce to the individual customer in long run ?Business to CustomerBusiness to BusinessCustomer to CustomerNone of the above
0 votes
0 votes
3 answers
3
makhdoom ghaya asked Aug 30, 2016
1,121 views
The principal electronic payment systems for electronic commerce isCredit CardDigital WalletElectronic ChequeAll of the above
2 votes
2 votes
1 answer
4
makhdoom ghaya asked Aug 30, 2016
2,474 views
"M-Commerce" refers toA myth which does not exist in realityThe ability of business to reach potential customers wherever they areThe ability to have large capacity of me...