How many hash functions does my bloom filter need?

前端 未结 5 431
旧巷少年郎
旧巷少年郎 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:40

    There is an excellent online bloomfilter calculator.

    This interactive bloom filter calculator lets you estimate and find out coefficients for your bloom filter needs. It also shows you graphs to see results visually and provides all the formulas For example, calculations for 216,553 n items with probability p of 0.01:

    n = ceil(m / (-k / log(1 - exp(log(p) / k))))
    p = pow(1 - exp(-k / (m / n)), k)
    m = ceil((n * log(p)) / log(1 / pow(2, log(2))));
    k = round((m / n) * log(2));
    

提交回复
热议问题