Exploring a possible solution
Now that we understand the limitations of standard binary search and the lower bound, we need a slightly refined approach to find the first element strictly greater than a target value. Simply finding a student with a score of 85 or even the first 85 is not enough when we want to determine the next higher score in the sorted list.
Upper bound
Similar to the lower-bound algorithm, the upper-bound algorithm is another popular variation of binary search. It aims to find the index of the first element in a sorted array that is strictly greater than the target.
Liking the course? Check our discounted plans to continue learning.