GATE CSE 2025 Session 2 Q35: Depth of node 19 in a binary search tree
- Programming and Data Structures
- 1 mark
- NAT
- No negative marking
Question
Suppose the values are inserted in that order into an initially empty binary search tree. Let be the resulting binary search tree.
The number of edges in the path from the node containing 19 to the root node of is ___________. (Answer in integer)
Try it: numerical answer: type the value
Show answer and explanation
Answer: 4 (official GATE 2025 final answer key)
Concept used: BST insertion: each key goes left or right by comparison from the root.
First step: Trace 19's insertion: compare with 10, 15, 30 and 20 before it is placed.
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2025 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Programming and Data Structures PYQs
- 2026 Session 1 · Q23Non-leaf indices in a 1-indexed binary heap with n odd
- 2026 Session 1 · Q24Empty slots after linear-probing inserts with h(x) = (x+7) mod 11
- 2026 Session 1 · Q33Maximum height of a full binary tree with 23 nodes
- 2026 Session 1 · Q34Output of a C function with a shadowed block variable
- 2026 Session 1 · Q39Recursive length of a non-empty singly linked list
- 2026 Session 1 · Q40Third insertion that can never yield a complete BST of 1..15