5,596 views

6 Answers

0 votes
0 votes
I think it will not be unique. We can have many tree with this inorder.
0 votes
0 votes
U can't get unique binary tree for sure. But this question from ISRO so u may approach like this. Take a heap structure (i.e. complete Binary tree) and fill nodes as given inorder. FBGADCE. Here A is  middle element so it will be root. Now FBG on left and  DCE on right. Do this recursively to build tree.

Now find pre order traversal. It ll be ABFGCDE.

#still i am saying this is one (not only) way to approach this problem. Bcoz complete binary tree is standard structure but the d way they frame this question is ambiguous.
0 votes
0 votes
yes multiple trees are possibe but in the above problem only option b matches as in pre order and in order the last element is rightmost element ie

LrR for inorder and rLR for pre order. so last element in inorder and pre order will be same.

Related questions

2 votes
2 votes
3 answers
1
2 votes
2 votes
2 answers
3
anurag_am asked Jun 15, 2015
5,984 views
how to convert into inorder traversal if preorder traversal of binary tree is given in the problem ? exaplain using example.
0 votes
0 votes
2 answers
4