Wrapping Up
Bloom filters can be used to save space even in instances where bit vectors cannot. A bit vector is generally limited to cases where our data is integers within a small range, but Bloom filters do not have these limitations. To keep themselves small, Bloom filters use the Monte Carlo approach—they sacrifice some accuracy in order to save space.
You’ve seen in previous chapters how Monte Carlo algorithms can also be used to gain speed. In short, then, the idea of Monte Carlo is to sacrifice some accuracy to gain either time or space.
In some cases, you may save both time and space. One example of this is using a Bloom filter to reduce database lookups (as described in Reducing Database Lookups). The main purpose of maintaining a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access