Exact running quantiles in linear expected time, if the input is shuffled

Everyone who runs a service has the dashboard: p50, p95, p99 latency. Almost everyone computes those percentiles with a sketch — t-digest, DDSketch, Greenwald–Khanna, KLL — trading exactness for tiny memory. This post is about refusing that trade. You want the exact 95th percentile of a stream, recomputed after every element, in the comparison model. And you know one helpful thing: the elements…