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?
- A18
- B6
- C17Correct answer
- D20
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.