Exploring a possible solution
Now that we understand the limitations of standard binary search for locating the first occurrence of a value, we need a slightly refined approach. Simply finding any student with a score of 85 is not enough. We need to identify the first student with that score in the sorted list.
Lower bound
The lower-bound algorithm is a popular variant of binary search. It aims to find the index of the first element in a sorted array greater than or equal to the target.
Liking the course? Check our discounted plans to continue learning.