Computer Science EngineeringHardISRO SC (CS)

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

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

Correct answer: C. 7

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

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

Exams that ask this topic