Skip to content

ISRO Scientist/Engineer CSE 2020Data Structures › Binary Trees and Binary Search Trees

ISRO Scientist/Engineer CSE 2020 PYQ: What is the in-order successor of 15 in the given binary search tree?

What is the in-order successor of 15 in the given binary search tree?

  1. A
    18
  2. B
    6
  3. C
    17
    Correct answer
  4. D
    20

Answer

(C) $17$

Approach

The in-order successor of a node in a BST is the next node visited in an in-order traversal. Equivalently, if the node has a right child, the successor is the leftmost (minimum) node in its right subtree. Here, node 15 has a right child 18, and the leftmost node in that right subtree is 17.

Reviewed by ISRO IQ Editorial Team.