Computer Science EngineeringHardISRO SC (CS)

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

  1. A. 7
  2. B. 6
  3. C. 8
  4. D. 9

Correct answer: A. 7

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

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

Exams that ask this topic