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 (19.2k points)   | 425 views

4 Answers

+12 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.2k points)  
selected by
+4 votes
Answer: D

Binary Tree is:

   /   \                          
  A    Y  
 /   \     \   
M  C    P           
     /     /  \
   B     F  H
answered by Veteran (34.2k points)  
+1 vote
option D)
answered by Junior (851 points)  
+1 vote


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 (47.3k points)  

Top Users May 2017
  1. akash.dinkar12

    3338 Points

  2. pawan kumarln

    2108 Points

  3. Bikram

    1922 Points

  4. sh!va

    1682 Points

  5. Arjun

    1614 Points

  6. Devshree Dubey

    1272 Points

  7. Debashish Deka

    1208 Points

  8. Angkit

    1056 Points

  9. LeenSharma

    1018 Points

  10. Arnab Bhadra

    812 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    1008 Points

  2. pawan kumarln

    734 Points

  3. Arnab Bhadra

    726 Points

  4. Arjun

    342 Points

  5. bharti

    328 Points

22,893 questions
29,196 answers
27,695 users