Binary Search Tree: GATE CS Previous Year Questions

Binary Search Tree · Data Structures

32 questions · asked in 17 of 27 years (2000–2026)

MCQ 26 · MSQ 2 · NAT 41-mark 20 · 2-mark 12

2000Questions per year2026

Questions 1–5 of 32

Q1GATE 2026 (Session 1)2 marksMCQ−0.67 if wrong
Let PP be the set of all integers from 11 to 1515. Consider any order of insertion of the elements of PP into a binary search tree that creates a complete binary tree.

Which one of the following elements can NEVER be the third element that is inserted?

Q2GATE 2026 (Session 1)2 marksNAT
The following sequence corresponds to the preorder traversal of a binary search tree TT :

50,25,13,40,30,47,75,60,70,80,7750,25,13,40,30,47,75,60,70,80,77

The position of the element 6060 in the postorder traversal of TT is ________ . (answer in integer)
Note: The position begins with 11.

Q3GATE 2026 (Session 2)2 marksMSQ
Consider a binary search tree (BST) with nn leaf nodes (n>0)(n>0). Given any node VV, the key present in the node is denoted as Val(V){Val}(V). All the keys present in the given BST are distinct. The keys belong to the set of real numbers.

For a node VV, let Suc(V){Suc}(V) denote the node that is its inorder successor. If a node VV does not have an inorder successor, then Suc⁡(V)\operatorname{Suc}(V) is NULLN U L L. As there are no duplicates, if Suc(V){Suc}(V) is not NULLN U L L, then Val(V)<Val(Suc(V)){Val}(V) < {Val}({Suc}(V)).

Corresponding to every leaf node LiL_{i} that has a non-NULL Suc⁡(Li)\operatorname{Suc}\left(L_{i}\right), a new key kik_{i} with the following property is to be inserted into the BST.

Val(Li)<ki<Val(Suc(Li)){Val}\left(L_{i}\right) < k_{i} < Val ({Suc}(L_{i}))

Let KK represent the list of all such new keys to be inserted into the BST.

Which of the following statements is/are true?

One or more options are correct.

Q4GATE 2025 (Session 1)1 markMSQ
Which of the following statement(s) is/are TRUE for any binary search tree (BST) having nn distinct integers?

One or more options are correct.

Q5GATE 2025 (Session 2)1 markNAT
Suppose the values 10, -4, 15, 30, 20, 5, 60, 19 are inserted in that order into an initially empty binary search tree. Let TT be the resulting binary search tree. The number of edges in the path from the node containing 19 to the root node of TT is ___________. (Answer in integer)

Keep practising

Topics in Data Structures

All CS topics ›