Pour items into a HyperLogLog sketch and watch 2^p registers track the longest run of leading zeros each one has seen. With a few KB of state, HLL estimates the count of distinct items in a stream that may be billions long — at a typical ±2 % standard error for p=14.
Each bar is one of the 2ᵖ registers; the height is the register's stored value — the longest run of leading zeros seen by any item that hashed into that bucket. Empty registers stay at 0.
HLL trades exactness for memory. A p=14 sketch is 12 KB and estimates billions of distinct items with about ±0.8 % standard error. The same job with a plain hash set would need megabytes for thousands of items, and gigabytes once you reach the billions. HLL sketches are mergeable: HLL(A ∪ B) = elementwise-max(HLL(A), HLL(B)), which is why Redis, BigQuery, Snowflake, and ClickHouse all use HLL (or HLL++) under the hood for COUNT DISTINCT approximations.