← Back to context

Comment by Someone

18 hours ago

Assuming independent hash functions, giving each hash function it’s own bit table is equivalent to having one bit table with a number of bits equal to that of the sum of the numbers of bits in each hash function.

It would be more effective in avoiding false positives, but require more (typically a lot more) space.

What's your basis for claiming either of these two things?

  • Logic.

    “It would be more effective in avoiding false positives”: consider a single hash function. To get a false positive, a necessary (but not sufficient) condition is that the bit position that it computes is set.

    If you use multiple hash functions with a single table, that happens if any of the hash functions produced the same bit position for a different key.

    If you use a single hash function for a bit set, your only chance for that to happen is that that same hash function produced the same bit position for a different key. That probability is lower.

    “but require more (typically a lot more) space”: if you give each of your k hash function a separate bit-table, memory usage grows by a factor of k.