On sorted data, many search problems collapse under two pointers converging from the ends. To find a pair summing to a target: start one finger at the smallest value and one at the largest. If the sum is too big, the largest cannot be in any answer with something even larger — retreat the right finger. If too small, advance the left. Each move permanently rules out a value, so the fingers meet after one linear sweep with no backtracking and no extra storage. The monotonic structure of the sorted array is what makes a rejected element rejectable forever — the mechanism spends the order to buy the single pass.
A sorted array and a target. The demo converges two pointers to the pair, eliminating one endpoint per step: live demo
“Finding a pair means checking all pairs.” — on sorted data, two converging pointers do it in one sweep: each comparison discards an endpoint that can never be part of the answer. cited
Two fingers walking toward each other; every step throws away an endpoint forever. The order of the data pays for the single pass. two-pointer
On the canonical compiler, two pointers on sorted [1,2,3,4,6] find the pair summing to 6 — the smaller member is 2 (with 4):