in DS edited by
5,952 views
4 votes
4 votes

Consider the following binary search tree T given below: Which node contains the fourth smallest element in T?

  1. Q
  2. V
  3. W
  4. X
in DS edited by
6.0k views

3 Comments

Answer is option C i.e W ??
0
0
correct c
0
0
U is smallest then Q is second smallest

W is greater than Q and X is smaller then W so X is third smallest .

  W is forth smallest
1
1

5 Answers

14 votes
14 votes
Best answer

Inorder traversal of BST sorts the elements in ascending order .

UQXWPVZY --> inorder traversal

4th smallest element is W.

selected by
by
6 votes
6 votes

The In-order traversal of BST gives number in sorted order

Here In-order traversal sequence is as follows

U Q X W P V Z Y

hence 4rth smallest will be W

Hence Option C) W will be the answer. 

by
4 votes
4 votes

Answer C) W

In BST left child is smaller than root value and right child is greater than root value.

1 vote
1 vote

1 st small = U

2 nd small = Q

3 rd small = X

4 th small = W  option A

1 comment

edited by

Answer : Option C ===> W

0
0
Answer:

Related questions