The Gateway to Computer Science Excellence
+19 votes
1.7k views

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 by Boss (30.8k points)
edited by | 1.7k views
0
Inorder traversal gives nodes in non-decreasing order
0

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.

2 Answers

+18 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.

by Boss (23.9k points)
edited by
+14
This is not quick, it's ONLY solution for this problem :D :)
+11 votes
option A is right .. chek for left root right rule
by Active (5k points)
0
A...
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,322 answers
198,393 comments
105,143 users