Loading page…
An online store removes cancelled orders from an array of a hundred thousand ids on a tablet with memory for one array. Deleting one at a time shifts the tail for every cancelled order, a little over two billion moves, about four seconds. One pass with a read pointer and a write pointer copies each kept entry once. The lesson counts moves on real runs, reverses a range with two pointers, rotates by three reversals, and shows why an edit that grows the array must write from the back.
You work on the order sync of an online store.