Java found a four. Which one?
transcript
Three fours in a sorted list. Java's binary search finds one. Which one does it return? It does not promise.
Seven payments, and the amount four. Java returned position three. That is the last four. The first four is at position one. Another list gives another copy.
Four fours in a row. Java returned position one. Not the first. Not the last. Java does not say which copy it returns.
For a missing value, Java returns a negative. Five is missing from our list. Java returned minus five. Negate it, and subtract one. That gives four, the insertion point. Read it as minus r, and you are off by one.
When you need the first copy, write the loop. Python and C plus plus have a real lower bound. Your lower bound returns the first copy. It never returns a negative number. A missing value gives its insertion point.
Write your own lower bound. Full breakdown in the lecture.