Skip to content

Resource · Guide or article

Bloom Filter

Covers the probabilistic set-membership structure that answers either 'maybe present' or 'definitely absent'. Useful for system design discussions as well as data structure rounds.

Reviewed

Open the original: Bloom Filter (opens the original site in a new tab)

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

Read this in other languages: Русский, Português, Українська A bloom filter is a space-efficient probabilistic data structure designed to test whether an element is present in a set. It is designed to be blazingly fast and use minimal memory at the cost of potential false positives. False positive matches are possible, but false negatives are not – in other words, a query returns either "possibly in set" or "definitely not in set". Bloom proposed the technique for applications where the amount of source data would require an impractically large amount of memory if "conventional" error-free hashing techniques were applied.

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Lesson

What it covers

  • Bit array of m bits with k hash functions, illustrated with the set x, y, z where m = 18 and k = 3
  • Insertion and search, both O(1), and why deletion is not supported
  • Why a search hit can be a false positive while a miss is always certain
  • False-positive probability formula in terms of k, m and n, and how to tune them
  • Example use: hiding already-read articles on a blog

How to use it

PrepKit study advice, not a claim made by the source.

Code a small filter with three hash functions, insert a few hundred strings, and measure the false-positive rate on strings you never inserted. Compare your result with the page's formula.

Scope and limitations

No guidance on choosing hash functions, and no variants such as counting filters. The default size of 100 mentioned on the page refers to the repository's implementation rather than general advice.

Access and format

README on GitHub in trekhleb/javascript-algorithms (MIT); Russian, Portuguese and Ukrainian versions are linked. English, free.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/data-structures/bloom-filter/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email