Bloom Filters and False Positives
Read a negative result as definite absence and a positive result as possible presence.
Core Intuition & How It Works
A Bloom filter is a compact probabilistic bit array that uses k independent hash functions to test set membership. It guarantees zero false negatives ("definitely not present") while allowing a tunable false-positive rate.
In the Byte Sized Algorithms interactive classroom, you can step forward and backward through this algorithm with your keyboard while watching the visual diagram, memory state, and highlighted pseudocode update together.
Time & Space Complexity
| Metric | Complexity |
|---|---|
| Time Complexity | O(k) insert and query |
| Space Complexity | O(m) bits |
| Topic Chapter | Chapter 6: Hashing |
| Difficulty Level | Intermediate |
Key Pattern to Recognize
Place a Bloom filter in front of an expensive disk or network lookup to skip non-existent keys cheaply.
Common Pitfalls & Edge Cases
Attempting to delete from a standard Bloom filter (clearing a bit can erase other keys; use a Counting Bloom Filter instead).
Real-World & Technical Interview Applications
LSM-tree databases (RocksDB, Cassandra), CDN one-hit-wonder filters, and web crawler URL deduplication.