Computer Science EngineeringHardISRO SC (CS)

The worst-case number of key comparisons binary search makes on a sorted array of 5000 elements (counting one three-way comparison per probe) is:

  1. A. 12
  2. B. 14
  3. C. 15
  4. D. 13

Correct answer: D. 13

Worst case = floor(log2 n) + 1 = 13.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic