Binary Search Trees questions

Q40

GATE CS 2026 CS-1Tree Data StructuresMCQ2 marks−2/3 if wrong
Let PP be the set of all integers from 1 to 15. 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?
Show answer without attempting

Answer: D

Q62

GATE CS 2026 CS-1Tree Data StructuresNAT2 marks
The following sequence corresponds to the preorder traversal of a binary search tree TT:

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

The position of the element 60 in the postorder traversal of TT is ______. (answer in integer)

Note: The position begins with 1.
Show answer without attempting

Answer: 7

Q49

GATE CS 2026 CS-2Tree Data StructuresMSQ2 marks
Consider a binary search tree (BST) with nn leaf nodes (n>0n > 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)Suc(V) is NULLNULL. As there are no duplicates, if Suc(V)Suc(V) is not NULLNULL, then Val(V)<Val(Suc(V))Val(V) < Val(Suc(V)).

Corresponding to every leaf node LiL_i that has a non-NULLNULL Suc(Li)Suc(L_i), a new key kik_i with the following property is to be inserted into the BST.

Val(Li)<ki<Val(Suc(Li))Val(L_i) < 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?
More than one option can be correct.
Show answer without attempting

Answer: A, C

Q26

GATE CS 2025 CS-1Tree Data StructuresMSQ1 mark
Which of the following statement(s) is/are TRUE for any binary search tree (BST) having nn distinct integers?
More than one option can be correct.
Show answer without attempting

Answer: A, B

Q35

GATE CS 2025 CS-2Tree Data StructuresNAT1 mark
Suppose the values 10,−4,15,30,20,5,60,1910, -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)
Show answer without attempting

Answer: 4

Q39

GATE CS 2024 CS-2Tree Data StructuresMCQ2 marks−2/3 if wrong
You are given a set VV of distinct integers. A binary search tree TT is created by inserting all elements of VV one by one, starting with an empty tree. The tree TT 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. You are not aware of the sequence in which these values were inserted into TT, and you do not have access to TT.

Which one of the following statements is TRUE?
Show answer without attempting

Answer: A

Q28

GATE CS 2022 CSTree Data StructuresNAT1 mark
Suppose 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 3rd3^{\text{rd}} largest element of the tree is stored at index_____________
Show answer without attempting

Answer: 509

Q10

GATE CS 2021 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
A binary search tree TT contains nn distinct elements. What is the time complexity of picking an element in TT that is smaller than the maximum element in TT?
Show answer without attempting

Answer: D

Q5

GATE CS 2020 CSTree Data StructuresMCQ1 mark−1/3 if wrong
The 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?
Show answer without attempting

Answer: B

Q41

GATE CS 2020 CSTree Data StructuresMCQ2 marks−2/3 if wrong
In a balanced binary search tree with nn elements, what is the worst case time complexity of reporting all elements in range [a,b][a, b]? Assume that the number of reported elements is kk.
Show answer without attempting

Answer: B

Q6

GATE CS 2017 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
Let TT be a binary search tree with 1515 nodes. The minimum and maximum possible heights of TT are:
Note: The height of a tree with a single node is 0.
Show answer without attempting

Answer: B

Q36

GATE CS 2017 CS-2Tree Data StructuresMCQ2 marks−2/3 if wrong
The pre-order traversal of a binary search tree is given by 12,8,6,2,7,9,10,16,15,19,17,2012, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:
Show answer without attempting

Answer: B

Q40

GATE CS 2016 CS-2Tree Data StructuresNAT2 marks
The number of ways in which the numbers 1,2,3,4,5,6,71, 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.
Show answer without attempting

Answer: 64.0

Q27

GATE CS 2015 CS-3Tree Data StructuresMCQ1 mark−1/3 if wrong
While inserting the elements 71,65,84,69,67,8371, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is
Show answer without attempting

Answer: B

Q17

GATE CS 2015 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)?

I. 3, 5, 7, 8, 15, 19, 25
II. 5, 8, 9, 12, 10, 15, 25
III. 2, 7, 10, 8, 14, 16, 20
IV. 4, 6, 7, 9, 18, 20, 25
Show answer without attempting

Answer: A

Q35

GATE CS 2015 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
Show answer without attempting

Answer: B

Q39

GATE CS 2014 CS-3Tree Data StructuresNAT2 marks
Suppose we have a balanced binary search tree TT holding nn numbers. We are given two numbers LL and HH and wish to sum up all the numbers in TT that lie between LL and HH. Suppose there are mm such numbers in TT. If the tightest upper bound on the time to compute the sum is O(nalog⁡bn+mclog⁡dn)O(n^a \log^b n + m^c \log^d n), the value of a+10b+100c+1000da + 10b + 100c + 1000d is ____.
Show answer without attempting

Answer: 110

Q7

GATE CS 2013 CSTree Data StructuresMCQ1 mark−1/3 if wrong
Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of nn nodes?
Show answer without attempting

Answer: C

Q43

GATE CS 2013 CSTree Data StructuresMCQ2 marks−2/3 if wrong
The 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?
Show answer without attempting

Answer: D

Q5

GATE CS 2012 CSTree Data StructuresMCQ1 mark−1/3 if wrong
The worst case running time to search for an element in a balanced binary search tree with n2nn2^n elements is
Show answer without attempting

Answer: C

0/200 correct0 marks

Related topics in Tree Data Structures