Data Structures & AlgorithmsHardGATE CS · Product placement

Binary search with mid = (lo + hi) // 2 (lo = 0, hi = n − 1, loop while lo ≤ hi) looks for 86 in [11, 13, 17, 24, 25, 32, 36, 58, 65, 86, 90]. Which elements are compared with the key, in order?

  1. A. 32, 65, 86
  2. B. 32, 65, 90, 86
  3. C. 32, 65, 86, 90
  4. D. 32, 65

Correct answer: A. 32, 65, 86

Each probe halves the range: 32 → 65 → 86. The key is found at index 9.

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

Exams that ask this topic