Upper bound

Books are shelved in number order. Three are numbered 14. Where would you put another 14 just after those three? Find the first book numbered above 14.

The boundaries low and high sit in gaps. They start before the first card and after the last. Check indices from low up to, but excluding, high.

Go right if the middle number is smaller than or equal to the target. All equal cards will end up to the left of the insertion point.

Each comparison roughly halves the number of cards left to check. Time is O(log(n + 1)) and extra space is O(1).