Overview
A Bloom filter hashes each inserted item to several bit positions and sets those bits. A query checks the same positions; if any bit is missing the item is definitely absent, otherwise it may be present.
Tests set membership with a compact bit array that allows false positives but not false negatives.
Compact metadata for implementation and discovery.
A Bloom filter hashes each inserted item to several bit positions and sets those bits. A query checks the same positions; if any bit is missing the item is definitely absent, otherwise it may be present.
Quick facts
Runtime and memory behavior at a glance.
Best
O(k)
Average
O(k)
Worst
O(k)
Space
O(m)
p ~= (1 - exp(-k*n/m))^kEstimates false positive probability from hash count, item count, and bit array size.
Show several hash functions setting and checking bits.
Bloom filters are best used as probabilistic prefilters, not as exact sets.
What each reference supports for this entry.
Original Bloom filter paper supporting probabilistic set membership and false positives.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Data Structures · Foundation
Bloom filters use less memory but give probabilistic answers.
Compare with thisData Structures · Core
Count-Min Sketch organizes data with different query and update tradeoffs than Bloom Filter.
Compare with thisSearching · Core
Membership queries are the primary operation supported by a Bloom filter.
Compare with thisMembership queries are the primary operation supported by a Bloom filter.
Bloom filters use less memory but give probabilistic answers.