Image for Flajolet-Martin Algorithm

Flajolet-Martin Algorithm

The Flajolet-Martin algorithm is a method used to estimate the number of unique items (like unique visitors or distinct IP addresses) in a large data set efficiently. It works by hashing each item to a binary number and observing patterns—specifically, the position of the first 1 bit in these hashes. By tracking the average position of the first 1 bits across many items, the algorithm can estimate the total number of unique entries without storing all of them, making it useful for analyzing massive data streams quickly and with minimal memory.