Bloom filter

Bloom filters are often used to detect whether an element is a member of a huge data set

1. Basic principle:

   (1) Set all the bit array elements of length m to 0;

   (2) For a member a in the set S, use k hash functions to calculate it, if h i (a)=x(1<=i<=k, 1<=x<=m), Then the xth position of the bit array is set to 1, and for member a, the w (w<=k) positions in the bit array may be set to 1.

2. False positive rate:

The Bloom filter has a misjudgment phenomenon, so it cannot be used in the scenario of 100% accurate judgment of set members.

3. Improvement:

There is a disadvantage of basic BF: the collection members cannot be deleted, only members can be added and queried

Compute the Bloom filter:

     Basic idea: store the basic information by multiple bits, and add 1 to the corresponding bit after k hash function calculations when a set member is added. When querying, as long as the position is not 0, it means that the member belongs to the set. When deleting, only the corresponding bit needs to be decremented by 1

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324740787&siteId=291194637