Home › GATE CS › PYQs › Programming & Data Structures › Trees, Binary Search Trees & Binary Heaps

Trees, Binary Search Trees & Binary Heaps — GATE CS Previous Year Questions

Practise GATE CS previous year questions on Trees, Binary Search Trees & Binary Heaps in Programming & Data Structures. Filter by year, marks and question type.

Public question previews

  • Let n be an odd number greater than 100. Consider a binary minheap with n elements stored in an array P whose index starts from 1. Which of the following indices of P do/does NOT correspond to any leaf node of the minheap? (2026 · 1 mark · MSQ)
  • The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The maximum possible height of a full binary tree with 23 nodes is _________. (answer in integer) (2026 · 1 mark · NAT)
  • Let P be the set of all integers from 1 to 15. Consider any order of insertion of the elements of P 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? (2026 · 2 marks · MCQ)
  • The following sequence corresponds to the preorder traversal of a binary search tree T: 50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77. The position of the element 60 in the postorder traversal of T is ______. (answer in integer) Note: The position begins with 1. (2026 · 2 marks · NAT)
  • Consider a binary search tree (BST) with n leaf nodes (n > 0). Given any node V, the key present in the node is denoted as Val(V). All the keys present in the given BST are distinct. The keys belong to the set of real numbers. For a node V, let Suc(V) denote the node that is its inorder successor. If a node V does not have an inorder successor, then Suc(V) is NULL. As there are no duplicates, if Suc(V) is not NULL, then Val(V) < Val(Suc(V)). Corresponding to every leaf node Li that has a non-NULL Suc(Li), a new key ki with the following property is to be inserted into the BST. Val(Li) < ki < Val(Suc(Li)) Let K represent the list of all such new keys to be inserted into the BST. Which of the following statements is/are true? (2026 · 2 marks · MSQ)