Use Multiple Hash Functions
We can turn our Gloom filter into a Bloom filter by using one deviously clever trick. And that is, we hash each value more than once upon each insertion and lookup. Let me explain.
You learned about hash function families in Chapter 10, Designing Great Hash Tables with Randomization. That is, we can create different hash functions that all use the same underlying hashing method and yet produce different hash codes. In that chapter, we created multiple hash functions that all use division hashing, but each hash function uses a different random prime number as part of its hashing calculation.
The main point I’m driving at here is that we can run a single value through a number of different hash functions, and each ...
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