GATE CSE Binary Search Trees PYQs
Binary Search Trees (BSTs) in GATE CS test a balance of traversal mechanics, structural properties, worst-case vs. balanced-case complexities, and sequential in… Read the guide
- Questions
- 21
- Asked
- since 2011
- Total marks
- 31
- Marks / paper
- 1.2
21 GATE CSE Binary Search Trees PYQs with solutions, from Programming and Data Structures. Browse all GATE CSE PYQs.
Questions
Every official paper that asked this topic, newest first.
- GATE CSE 2026 Set 1 · Q40Let be the set of all integers from 1 to 15. Consider any order of insertion of the elements of 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?MCQ2 marksMediumSolve
- GATE CSE 2026 Set 1 · Q62The following sequence corresponds to the preorder traversal of a binary search tree : The position of the element 60 in the postorder traversal of is ________. (answer in integer) Note: The position begins with 1.NAT2 marksEasySolve
- GATE CSE 2026 Set 2 · Q49Consider a binary search tree (BST) with leaf nodes (). Given any node , the key present in the node is denoted as . All the keys present in the given BST are distinct. The keys belong to the set of real numbers. For a node , let denote the node that is its inorder…MSQ2 marksMediumSolve
- GATE CSE 2025 Set 1 · Q26Which of the following statement(s) is/are TRUE for any binary search tree (BST) having distinct integers?MSQ1 markEasySolve
- GATE CSE 2025 Set 2 · Q35Suppose 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)NAT1 markEasySolve
- GATE CSE 2024 Set 2 · Q39You are given a set of distinct integers. A binary search tree is created by inserting all elements of one by one, starting with an empty tree. The tree follows the convention that, at each node, all values stored in the left subtree of the node are smaller than the value stored at the node.…MCQ2 marksEasySolve
- GATE CSE 2022 · Q28Suppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the array indices start with 0, the largest element of the tree is stored at index ________.NAT1 markMediumSolve
- GATE CSE 2021 Set 1 · Q10A binary search tree contains distinct elements. What is the time complexity of picking an element in that is smaller than the maximum element in ?MCQ1 markEasySolve
- GATE CSE 2020 · Q5The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree?MCQ1 markEasySolve
- GATE CSE 2020 · Q41In a balanced binary search tree with elements, what is the worst case time complexity of reporting all elements in range ? Assume that the number of reported elements is .MCQ2 marksEasySolve
- GATE CSE 2017 Set 1 · Q6Let be a binary search tree with 15 nodes. The minimum and maximum possible heights of are: Note: The height of a tree with a single node is 0.MCQ1 markEasySolve
- GATE CSE 2017 Set 2 · Q36The pre-order traversal of a binary search tree is given by 12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:MCQ2 marksMediumSolve
- GATE CSE 2016 Set 2 · Q40The number of ways in which the numbers 1, 2, 3, 4, 5, 6, 7 can be inserted in an empty binary search tree, such that the resulting tree has height 6, is _______ . *Note: The height of a tree with a single node is 0.*NAT2 marksMediumSolve
- GATE CSE 2015 Set 1 · Q10Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)? I. II. III. IV. MCQ1 markEasySolve
- GATE CSE 2015 Set 1 · Q23What are the worst-case complexities of insertion and deletion of a key in a binary search tree?MCQ1 markEasySolve
- GATE CSE 2015 Set 3 · Q13While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level isMCQ1 markEasySolve
- GATE CSE 2014 Set 3 · Q39Suppose we have a balanced binary search tree holding numbers. We are given two numbers and and wish to sum up all the numbers in that lie between and . Suppose there are such numbers in . If the tightest upper bound on the time to compute the sum is …NAT2 marksMediumSolve
- GATE CSE 2013 · Q7Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of nodes?MCQ1 markEasySolve
- GATE CSE 2013 · Q43The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?MCQ2 marksMediumSolve
- GATE CSE 2012 · Q5The worst case running time to search for an element in a balanced binary search tree with elements isMCQ1 markEasySolve
- GATE CSE 2011 · Q29We are given a set of distinct elements and an unlabeled binary tree with nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree?MCQ2 marksEasySolve
What GATE tests in Binary Search Trees
Concepts, patterns, formulas and traps distilled from past papers.
Binary Search Trees (BSTs) in GATE CS test a balance of traversal mechanics, structural properties, worst-case vs. balanced-case complexities, and sequential insertion dynamics. Questions frequently test the fundamental invariant that an inorder traversal yields a strictly sorted sequence, enabling unique reconstruction from preorder or postorder alone. Recent years (2022–2026) show a noticeable shift toward structural constraints (complete BSTs, heap/array indexing, ancestor insertion order dependencies, and successor relationships).
Core concepts
- Strict sortedness of inorder traversal for distinct keys
- Uniqueness of BST reconstruction given preorder or postorder traversal
- Degenerate / skewed BST structure and worst-case O(n) search/insert/delete complexity
- Balanced BST O(log n) height and range query cost O(log n + m)
- Ancestor insertion dependency in BST construction
- Array representation indexing for complete BSTs
- Inorder successor and predecessor properties (especially at leaf nodes)
- Constant-time heuristics (e.g., picking any key smaller than the maximum via root / left child)
Recurring question patterns
Preorder to Postorder Conversion / Traversal Indexing
Commonmixed2 marks2026, 2020, 2017, 2013Given the preorder traversal sequence of a BST, deduce its unique structure (since inorder is implicit by sorting the keys) and find either the complete postorder traversal sequence or the 1-based position of a specific element.
Sequential Insertion & Resulting Tree Structure
Commonmixed1 marks2025, 2015Simulate the sequential insertion of a given list of keys into an initially empty BST to determine node depths, lowest level elements, ancestor-descendant relationships, or edge distances to the root.
BST Structural Combinatorics and Height Extremes
Commonmixed1.5 marks2017, 2016, 2011Determine the minimum/maximum height of a BST with nodes, the number of insertion permutations yielding a degenerate chain (), or the number of ways to populate an unlabeled binary tree structure ( way).
Time Complexity of BST Operations & Range Queries
CommonMCQ1 marks2021, 2015, 2014, 2013Evaluate worst-case vs. balanced-case time complexities for search, insert, delete ( vs. ), non-trivial queries like finding an element smaller than the maximum (), or range-search reporting ().
Complete/Perfect BST Array Indexing & Insertion Constraints
Occasionalmixed2 marks2026, 2022Exploit complete binary tree array mappings () or ancestor-descendant dependencies to identify element positions (e.g., largest element) or deduce invalid insertion prefixes.
Theoretical / Property-Based True-False & MSQ
OccasionalMSQ1.5 marks2026, 2025, 2024Multi-statement verification involving fundamental properties: inorder uniquely determined from set , heap vs. BST comparison, max path lengths, and insertion between leaves and inorder successors.
Formulas GATE uses
Permutations for Degenerate (Skewed) BST of Height $n-1$
Used to count valid insertion sequences of distinct elements that result in a completely skewed BST (linear chain of height , where height of single node is 0).
Minimum and Maximum Heights for $n$ Nodes
Used when computing height bounds of arbitrary BSTs with nodes (under single-node height = 0 convention).
Complete Binary Tree 0-Indexed Array Mapping
Used when navigating complete BSTs stored contiguously in an array to locate root, extreme keys, or children.
Range Search Time Complexity in Balanced BST
Used for finding and summing/reporting all keys falling within an interval in a balanced BST of size .
Substitutions in Balanced BST Height
Used when analyzing search complexities where the number of elements is expressed as an asymptotic function of another parameter .
Examiner traps in Binary Search Trees
- Assuming BST search is always O(log n) and forgetting worst-case unbalanced/skewed tree is O(n).
- Off-by-one errors in height definitions: GATE standardizes single-node tree height as 0 (unless stated otherwise), making root-to-leaf path length equal to height.
- Confusing 0-indexed vs. 1-indexed complete tree array layouts (2i+1 vs. 2i).
- Assuming an element can be inserted at any time in a fixed shape tree, forgetting that all its ancestor keys must be inserted before it.
- Assuming min-heap and BST properties can coexist for arbitrary binary trees; BST left children are strictly smaller than parents, violating min-heap property.
- Counting nodes instead of edges (or vice-versa) when determining path lengths from a node to the root.
How questions are asked
- Preorder/postorder array sequence conversion
- Finding the 1-based traversal rank/index of a specific key (NAT)
- Simulating sequential insertions and reporting edge/depth distance
- Counting insertion permutations that satisfy a structural constraint (e.g., maximum height)
- Locating kth largest/smallest elements in complete BST array representation
- Multi-statement conceptual validation (MSQ) on BST invariants and successor properties
Paper trends
Shift from standard preorder-to-postorder MCQ conversions to NAT questions asking for the exact numeric index/position of a node in a specific traversal.
2026, 2020, 2017, 2013
Introduction of conceptual MSQs testing deep structural invariants (e.g., inorder successors of leaf nodes, heap comparison, path length bounds).
2026, 2025
Integration of BST properties with complete binary tree / heap array layout mathematics.
2026, 2022
Difficulty notes
Easy questions (1 mark) test direct BST insertion tracing, identifying valid sorted inorder sequences, simple time complexities, or standard min/max height formulas. Medium questions (2 marks) test tree reconstruction with follow-up index queries, combinatorial counts of insertion sequences, multi-parameter range search bounds, or ancestor-dependency constraints on complete BSTs.