edited by
6,022 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
edited by

5 Answers

Best answer
14 votes
14 votes

Inorder traversal of BST sorts the elements in ascending order .

UQXWPVZY --> inorder traversal

4th smallest element is W.

selected 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. 

4 votes
4 votes

Answer C) W

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

Answer:

Related questions

9 votes
9 votes
9 answers
2
ajit asked Sep 23, 2015
14,767 views
How many different trees are there with four nodes $\text{A, B, C}$ and $\text{D}?$$30$$60$$90$$120$
5 votes
5 votes
5 answers
3
29 votes
29 votes
4 answers
4
Arjun asked Feb 12, 2020
21,978 views
In a balanced binary search tree with $n$ elements, what is the worst case time complexity of reporting all elements in range $[a,b]$? Assume that the number of reported ...