GATE Computer ScienceModerateGATE CSE · NIELIT

A BST is built by inserting 50, 30, 70, 20, 40, 60, 80, 35, 45 in this order. How many nodes lie in the right subtree of the node 30?

  1. A. 3
  2. B. 2
  3. C. 4
  4. D. 5

Correct answer: A. 3

The right subtree of 30 holds the keys greater than 30 and less than 50: 40, 35 and 45, so 3 nodes.

More Programming and Data Structures (GATE) questions

Exams that ask this topic