First time here? Checkout the FAQ!
+2 votes

The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But it is not known which is which.


Pick the true statement from the following.

  1. I and II are preorder and inorder sequences, respectively
  2. I and III are preorder and postorder sequences, respectively
  3. II is the inorder sequence, but nothing more can be said about the other two sequences
  4. II and III are the preorder and inorder sequences, respectively
asked in Algorithms by Veteran (18.3k points)   | 331 views

4 Answers

+10 votes
Best answer
In preorder, root comes at the beginning of the traversal sequence and in postorder, root comes at the last of the traversal sequence. So, out of the given sequences only 1 and 2 are having such kind of order i.e K at the beginning and at the last.

Therefore, 2 is the preorder and 1 is postorder and the left sequence i.e 3 will definitely be inorder.

So, option d is correct.
answered by Active (2.1k points)  
selected by
+3 votes
Answer: D

Binary Tree is:

   /   \                          
  A    Y  
 /   \     \   
M  C    P           
     /     /  \
   B     F  H
answered by Veteran (33.8k points)  
+1 vote
option D)
answered by Junior (831 points)  
0 votes


Using this as preorder KAMCBYPFH and inorder MABCKYFPH .

So this gives II and III are the preorder and inorder sequences, respectively.

Ans is option D

answered by Veteran (43.2k points)  
Top Users Jan 2017
  1. Debashish Deka

    7508 Points

  2. Habibkhan

    4716 Points

  3. Vijay Thakur

    4368 Points

  4. sudsho

    4316 Points

  5. saurabh rai

    4170 Points

  6. santhoshdevulapally

    3436 Points

  7. Arjun

    3432 Points

  8. Bikram

    3240 Points

  9. GateSet

    3202 Points

  10. Sushant Gokhale

    3042 Points

Monthly Topper: Rs. 500 gift card

18,898 questions
23,865 answers
20,186 users