in DS edited by
7,255 views
25 votes
25 votes

Which of the following is/are correct in order traversal sequence(s) of binary search tree(s)?

  1. $3, 5, 7, 8, 15, 19, 25$
  2. $5, 8, 9, 12, 10, 15, 25$
  3. $2, 7, 10, 8, 14, 16, 20$
  4. $4, 6, 7, 9, 18, 20, 25$
  1. I and IV only
  2. II and III only
  3. II and IV only
  4. II only
in DS edited by
7.3k views

4 Comments

Inorder traversal gives nodes in non-decreasing order
2
2

In $Inorder$ traversal first left node is printed then root node and finally right node.
$Left Node -> Root Node -> Right Node$

In a BST, $Left Node=< Root Node < Right Node$ Hence, Inorder always traverses the BST in ascending order.

1
1
It is unbelievable that GATE is asking such questions
1
1
Look it as a whole paper point of view. I did the same mistake thinking like this for JEE questions. Try to solve the whole set of 65 questions and then in that you won't feel the same about this question.
3
3

3 Answers

28 votes
28 votes
Best answer

In order traversal of key are always in ascending order.

So, here I & IV th sequence  are in ascending order so Option A is Answer.

edited by

1 comment

This is not quick, it's ONLY solution for this problem :D :)
17
17
12 votes
12 votes
option A is right .. chek for left root right rule

1 comment

A...
0
0
1 vote
1 vote
Simply look for the sequences having ascending order, that's it!

You'll get the answer!
Answer:

Related questions