The GATE Grind

GATE 2025 CS (CS2) – Question 35

Programming and Data Structures · Trees and Binary Search Trees · 1 mark · Numerical answer

Suppose the values $10, -4, 15, 30, 20, 5, 60, 19$ are inserted in that order into an initially empty binary search tree. Let $T$ be the resulting binary search tree.

The number of edges in the path from the node containing 19 to the root node of $T$ is ___________. (Answer in integer)

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 4

Explanation

Insertions give the path 10 → 15 → 30 → 20 → 19 (19 is the left child of 20). That path has 4 edges.