Loading page…
A parcel-delivery app wants two waiting parcels that fill a truck's spare capacity exactly. The first attempt checks every pair, about 1.25 billion checks at a central hub. On a list sorted by weight, one pointer at each end rules out one parcel with every comparison, so the pass is O(n) with O(1) extra memory.
A delivery truck is about to leave a hub.