GATE Computer ScienceModerateGATE CSE · NIELIT

A sorted array holds 1000 distinct elements and binary search (one three-way comparison per probe) is applied. What is the worst-case number of element comparisons?

  1. A. 10
  2. B. 9
  3. C. 11
  4. D. 8

Correct answer: A. 10

Each probe halves the range, so at most ⌊log₂ 1000⌋ + 1 = 10 comparisons are needed.

More Algorithms questions

Exams that ask this topic