edited by
7,472 views
4 votes
4 votes

The in-order traversal of a tree resulted in FBGADCE. Then the pre-order traversal of that tree would result in

  1. FGBDECA
  2. ABFGCDE
  3. BFGCDEA
  4. AFGBDEC
edited by

4 Answers

Best answer
8 votes
8 votes
If we try to generate tree from question, we get following tree.

                        A

                  B             C

       F               G      D       E

 

Its inorder = FBGADCE

and preorder = ABFGCDE
selected by
1 votes
1 votes
This Question is ambiguous to construct a tree we must have either $InOrder & PreOrder or  InOrder & PostOrder$

but for a binary search tree we can only have PreOrder or PostOrder as in order of BST is non-decreasing order of keys.
0 votes
0 votes
inorder is given that means left root right means middle one is our root .  so here in given inorder middle one is A in  FBGADCE then break into 2 part on left  FBG and on right DCE then apply same thing on FBG here B is middle and other hand C is middle then now we have tree . from tree we easily get preorder
Answer:

Related questions

9 votes
9 votes
3 answers
1
go_editor asked Jun 23, 2016
21,466 views
The average depth of a binary search tree is$O(n^{0.5})$$O(n)$$O(\log n)$$O(n \log n)$
9 votes
9 votes
7 answers
2
shibu asked Jun 15, 2016
7,362 views
If node A has three siblings and B is parent of A, what is the degree of A?0345
10 votes
10 votes
3 answers
3
ajit asked Oct 1, 2015
10,210 views
How many distinct binary search trees can be created out of $4$ distinct keys?$5$$14$$24$$35$
2 votes
2 votes
2 answers
4
GO Classes asked Feb 4
274 views
Consider a binary tree. Among the following traversal combinations, which of them can uniquely construct the tree?Inorder + PreorderPreorder + PostorderOnly InorderInorde...