Bloom Filter algorithm

 Bloom Filter algorithm :

  In order to reduce the concept of conflict, Bloom Filter using multiple hash functions, instead of one. BitSet to create an m-bit, all the first bits are initialized to 0, and then selecting k different hash functions. The i-th hash function hashes the resulting string str denoted as h (i, str), and h (i, str) in the range of 0 to m-1

Processing of strings:

  For strings str, calculates h (1, str), h (2, str) ...... h (k, str). Then the first h BitSet of (1, str), h (2, str) ...... h (k, str) bit is set to 1.

 

Checks a string of process:

  For strings str, calculates h (1, str), h (2, str) ...... h (k, str). Then check the first BitSet h (1, str), h (2, str) ...... h (k, str) whether the bit is 1, if any one is not possible to determine a certain str had not been recorded. If all bits are 1, then "that" the presence of the string str. If a character string corresponding to Bit 1 is incomplete, you can be sure that the string is not necessarily recorded through Bloom Filter. (This is apparently because the string had been recorded, the corresponding bit is set to 1 sure all the) However, if a string corresponding Bit all 1, is actually not 100% sure the string is Bloom Filter records before. (Because it is possible to have all the bits of the string is exactly corresponding to a different string) This string into the wrong circumstances, called false positive (false positive rate).

The removal process of the string:

  Was added to the string can not be deleted because deletion will affect the other string. Really you need to remove the string can use Counting bloomfilter (CBF), which is a variant of the basic Bloom Filter. It standard Bloom Filter extended bits of each bit group is a small counter ( Counter ), to the corresponding insertion element when K ( K is the number of hash functions) th Counter values are added 1 to time, remove elements corresponding to the k th Counter value is decremented by 1 .

 

Guess you like

Origin www.cnblogs.com/hdc520/p/11469529.html