Data Structures & AlgorithmsModerateGATE CSE

What is the maximum number of element comparisons a binary search (one three-way comparison per step) makes on a sorted array of 100 elements?

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

Correct answer: A. 7

Each step halves the range: floor(log2 100) + 1 = 7 probes in the worst case.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic