Top MCQs on Binary Search Tree (BST) Data Structure with Answers

Last Updated :
Discuss
Comments

Question 1

In a balanced binary search tree with n elements, what is the worst-case time complexity of reporting all elements in the range [a,b]? Assume that the number of reported elements is k.

  • Θ(log n)

  • Θ(log(n)+k)

  • Θ(k log n)

  • Θ(n log k)

Question 2

A binary search tree T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than the maximum element in T?

  • Θ(nlogn)

  • Θ(n)

  • Θ(logn)

  • Θ(1)

Question 3

A binary search tree is generated by inserting in order the following integers:
 50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24 
The number of nodes in the left subtree and right subtree of the root respectively is
  • (4, 7)
  • (7, 4)
  • (8, 3)
  • (3, 8)

Question 4

How many distinct BSTs can be constructed with 3 distinct keys?

  • 4

  • 5

  • 6

  • 9

Question 5

A binary search tree is used to locate the number 43. Which of the following probe sequences are possible and which are not? Explain
  • 61 52 14 17 40 43
  • 2 3 50 40 60 43
  • 10 65 31 48 37 43
  • 81 61 52 14 41 43
  • 17 77 27 66 18 43

Question 6

The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16 What is the height of the binary search tree ?

  • 3

  • 4

  • 5

  • 6

Question 7

Postorder traversal of a given binary search tree T produces following sequence of keys: 3, 5, 7, 9, 4, 17, 16, 20, 18, 15, 14 Which one of the following sequences of keys can be the result of an in-order traversal of the tree T?
  • 3, 4, 5, 7, 9, 14, 20, 18, 17, 16, 15
  • 20, 18, 17, 16, 15, 14, 3, 4, 5, 7, 9
  • 20, 18, 17, 16, 15, 14, 9, 7, 5, 4, 3
  • 3, 4, 5, 7, 9, 14, 15, 16, 17, 18, 20

Question 8

A binary search tree is used to locate the number 43. Which one of the following probe sequence is not possible?

  • 61, 52, 14, 17, 40, 43

  • 10, 65, 31, 48, 37, 43

  • 81, 61, 52, 14, 41, 43

  • 17, 77, 27, 66, 18, 43

Question 9

Which of the following statements is false ? (A) Optimal binary search tree construction can be performed efficiently using dynamic programming. (B) Breadth-first search cannot be used to find connected components of a graph. (C) Given the prefix and postfix walks of a binary tree, the tree cannot be re-constructed uniquely. (D) Depth-first-search can be used to find the connected components of a graph.
  • A
  • B
  • C
  • D

Question 10

Access time of the symbol table will be logarithmic if it is implemented by

  • Linear list

  • Search tree

  • Hash table

  • Self organization list

There are 41 questions to complete.

Take a part in the ongoing discussion