GATE CS 2020 · Question 51 · Programming and Data Structures · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

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

  1. (A) Θ(log n)
  2. (B) Θ(log n + k)
  3. (C) Θ(k log n)
  4. (D) Θ(n log k)
Answer

Answer (B)

Answer from the official GATE CS 2020 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes