Loading page…
A bank app sorts two million card payments and must say how many were smaller, equal and larger than any amount, fifty thousand times a day. Comparing every payment costs a hundred billion comparisons. Two binary searches do it: the lower bound is the first position not below the amount, the upper bound the first position above it, and they differ by one operator. The lesson shows what they answer with repeats and missing values, how Python, C++ and Java behave when run, and the mistakes at the edges.
You work on the analytics of a bank app.