A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Bloom Filters

Research Depth 98 in the knowledge graph I know this Set as goal
2topics build on this
564prerequisites beneath it
See this on the map →
Bloom Filters: Space-Efficient Probabilistic Set MembershipUniversal and Perfect Hashing+1 moreStreaming Algorithms
bloom-filter probabilistic-data-structures space-efficiency false-positives

Core Idea

A Bloom filter is a space-efficient probabilistic data structure for approximate set membership queries. It uses a bit array of m bits and k independent hash functions: inserting an element sets k bit positions; querying checks whether all k positions are set. False negatives are impossible (inserted elements always test positive), but false positives occur when unrelated elements happen to set the same bit positions. The false positive rate for n elements is approximately (1 - e-kn/m)k, minimized when k = (m/n) ln 2. With optimal parameters, a Bloom filter uses about 1.44 log_2(1/epsilon) bits per element for false positive rate epsilon — far less than storing the elements themselves. Variants include counting Bloom filters (supporting deletion), cuckoo filters (better space for low epsilon), and Bloom filter cascades.

Explainer

You have seen the basic Bloom filter idea in data structures: a bit array with hash functions that supports fast approximate membership queries. At the expert level, the focus shifts to understanding the precise mathematical tradeoffs, the information-theoretic limits, and the design space of variants that extend the basic structure.

The false positive analysis is clean. After inserting n elements with k hash functions into m bits, each specific bit remains 0 with probability (1 - 1/m)kn ≈ e-kn/m. A false positive occurs when all k bits for a non-member happen to be 1, with probability (1 - e-kn/m)k. Minimizing over k (taking the derivative and setting it to zero) gives the optimal k = (m/n) ln 2, at which point exactly half the bits are set. This yields a false positive rate of (1/2)k = (1/2)^((m/n) ln 2) = 2-m ln 2 / n, or equivalently, achieving rate epsilon requires m = n * log_2(1/epsilon) / ln 2 ≈ 1.44 * n * log_2(1/epsilon) bits.

The 1.44 factor above the information-theoretic minimum of log_2(1/epsilon) bits per element is the "price of simplicity." Standard Bloom filters are not optimal data structures for approximate membership — but they are close, and their simplicity (bit-parallel operations, no pointer overhead, cache-friendly) makes them practical favorites. When the 44% overhead matters, alternatives exist: compressed Bloom filters reduce space by allowing the bit array to be entropy-coded; Golomb-coded sets achieve near-optimal space; cuckoo filters match or beat Bloom filter space while supporting deletions.

The variant landscape is rich. Counting Bloom filters replace bits with counters to support deletion (at ~4x space cost). Scalable Bloom filters grow dynamically as elements arrive. Bloomier filters store associated values, not just membership. Spectral Bloom filters count multiplicities. In distributed systems, Bloom filters are used for set reconciliation — two parties can efficiently determine which elements they share by exchanging Bloom filters. The common thread is the fundamental tradeoff: a small amount of space buys approximate answers to set queries, with a tunable, well-understood error rate.

Practice Questions 4 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesFinite State Machines (FSMs)Deterministic Finite Automata (DFA)Nondeterministic Finite Automata (NFA)Two-Way Finite AutomataNFA to DFA Conversion (Subset Construction)DFA Properties and Minimization AlgorithmsRegular Languages: Definition and CharacterizationContext-Free Grammars (CFGs)Pushdown Automata (PDA)Equivalence of CFGs and Pushdown AutomataClosure Properties of Context-Free LanguagesLimitations of Context-Free LanguagesPumping Lemma for Context-Free LanguagesTuring MachinesVariants of Turing Machines and EquivalenceNondeterministic Time Complexity and NPThe P vs. NP ProblemComplexity Class P: Polynomial TimeRandomized AlgorithmsUniversal and Perfect HashingBloom Filters

Longest path: 99 steps · 564 total prerequisite topics

Prerequisites (3)

Leads To (1)