How many hash functions does my bloom filter need?

前端 未结 5 428
旧巷少年郎
旧巷少年郎 2020-12-12 23:10

Wikipedia says:

An empty Bloom filter is a bit array of m bits, all set to 0. There must also be k different hash functions defined, each of which map

5条回答
  •  佛祖请我去吃肉
    2020-12-12 23:17

    If you read further down in the Wikipedia article about Bloom filters, then you find a section Probability of false positives. This section explains how the number of hash functions influences the probabilities of false positives and gives you the formula to determine k from the desired expected prob. of false positives.


    Quote from the Wikipedia article:

    Obviously, the probability of false positives decreases as m (the number of bits in the array) increases, and increases as n (the number of inserted elements) increases. For a given m and n, the value of k (the number of hash functions) that minimizes the probability is

    formula

提交回复
热议问题