AlgoScope

Bloom Filter

Data structureadvancedCaches and Filters

A probabilistic set: k hash functions set k bits; false positives possible, false negatives impossible.

Decision · step 6 of 10Bloom Filter: Four words in, one stranger looks like a member
1✓01✓11✓2031✓4051✓60708091✓101✓111✓121✓13014015

Query "cat": hashes 6, 4, 0. All three bits are 1, so the answer is "probably", and here it happens to be right: "cat" was inserted.

Open in the player →or start at step 6

What you will see

A key lights up k bits; a query checks the same k bits.

How bloom filter works →

Cost

insertO(k)
queryO(k)
SpaceO(m bits)

False-positive rate depends on mn and k.

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.

Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.

Related