ProgrammingHard

In a sorted array with duplicates, which index does a lower_bound search return for the key 5 in [1, 5, 5, 5, 8]?

  1. A. 2
  2. B. 1
  3. C. 3
  4. D. 4

Correct answer: B. 1

lower_bound returns the first position whose value is not less than 5, which is index 1.

More C Programming questions

Exams that ask this topic