Bloom Filter

A space-efficient probabilistic data structure that tests whether an element is a member of a set, allowing false positives but never false negatives.

Method

Uses a bit array of size m and k independent hash functions. Insertion sets the k bits corresponding to the hashes of the element. Query checks whether all k bits are set. False positive rate ≈ (1 − e^{−kn/m})^k.

Applications

Database query filtering (avoid disk lookups), web caching, network packet inspection, cryptocurrency (Bitcoin UTXO), spell checkers, distributed systems membership.

Advantages

Extremely memory efficient; constant-time insert and query; tunable false-positive rate; simple to implement.

Limitations

Cannot delete elements (counting Bloom filters mitigate); false positives require careful rate control; hash quality affects performance; no element listing possible. Delete only known inserted items with correctly handled multiplicities; deleting a false-positive match can cause false negatives.

Alternatives

Cuckoo filters (support deletion), quotient filters, perfect hashing, traditional hash sets when memory is abundant.

Example

Chrome checks URLs against malicious list without storing all URLs.

Editorial clarification

Delete only known inserted items with correctly handled multiplicities; deleting a false-positive match can cause false negatives.

Sources

Educational reference only, not professional advice.

All algorithms