Find the cut first.
transcript
A sorted list, cut once. Binary search breaks on it. Find the cut first.
A ring buffer that wrapped. Two sorted runs. Slots zero to four hold the newest ids. Slots five to nine hold the oldest. The oldest id is where the second run starts.
Try the usual search for sixty-seven. Slot five holds three. That is lower. So it goes right, and misses. But sixty-seven is in slot one.
Compare each id with the last id. Above it: first run. At most it: second run. The answers flip once. So a first-true search finds slot five.
First, find where the second run starts. Second, pick the run with the last id. Third, run the lower bound inside it. Each one is a small binary search.
A ring of one million slots. The scan makes one million comparisons. The two searches make at most forty.
Compare with the last id. Two small searches beat a scan of the whole ring. Full breakdown in the lecture.