Bloom filters and sketches

A Bloom filter answers "is this in the set?" in a few bits per item, and it is allowed to be wrong — but only in one direction. If it says no, the answer is no, provably. If it says yes, it might be wrong, and how often it is wrong is not luck: it follows from three numbers you choose. These four pages show the structure one bit at a time over six words in a thirty-two-bit filter you can check by hand, then build real filters and count hundreds of thousands of real queries against them to see whether the textbook formula actually predicts what happens. Two more pages take the same idea somewhere else: counters instead of bits, so items can be deleted — and a grid of counters that estimates how often something appeared in a stream, with an error that can only ever be too high.

Measured curves against textbook bounds, for ordinary algorithms, are in the complexity plotter. Hashing's other great application — finding a pattern in text — is in String matching. The bits themselves are in Bits, floats, text and encodings.