Bloom filter was proposed by bloom in 1970. It is actually a very long binary vector and a series of random ing functions. The bloom filter can be used to retrieve whether an element is in a collection. Its advantage is that the space efficiency and query time far exceed the averageAlgorithmThe disadvantage is that it has a certain false recognition rate and is difficult to delete.For the principles of bloom filter, refer to Wikipedia [1], thesis [2], and networkArticle[3], there are also Articles [4] with simpleProgram.
My summary:
1. The principle of bloom filter is very simple. It can be said that it is an extension of bit-map. Bit-map uses a hash function to map data to a certain position in the array, bloom filter uses k hash functions to map data to the K-Bit Array. During detection, this data exists only when K-bit is set to 1;
2. Advantages of bloom filter over bit-map. Bit-map is actually a hash table. The most common problem with the hash table is address conflict. As mentioned in [4], "to reduce the probability of a conflict to 1%, set the length of the bitset to 100 times the number of URLs. ", Because bloom filter uses multiple hash functions, the probability of conflict is very low. In the paper [2], the error probability of bloom filter is analyzed. In general, the error probability of the bloom filter is low, and the space efficiency is high;
3. If the size of the bit array is m, the added data is N, and the number of hash functions is K, the document [2] shows that for a given m, n, when K = ln (2) * M/N, the error probability is the smallest;
4. Features of bloom filter: ① do not store original data; ② do not count inserted data; ③ the inserted data cannot be deleted, because deletion (that is, clearing the corresponding K bit) will affect the bit of other data ing. In contrast, bit-map can delete data (because the data to bit is one-to-one );
5. In the application scenario, the characteristics of the bloom filter (not storing raw data, not counting, and not deleting) show that it is very suitable for recording and querying whether some data has "appeared, for example, a Web Crawler needs to record the accessed URL to avoid repeated crawling of a web page (document [4] lists and compares different methods of this example ), you can map the URL to the bit array of the bloom filter. Of course, there is a premise for applying the bloom filter-a certain error rate is allowed!
References:
[1] http://en.wikipedia.org/wiki/Bloom_filter
[2] http://pages.cs.wisc.edu /~ CAO/papers/Summary-Cache/node8.html
[3] http://blog.csdn.net/jiaomeng/article/details/1495500
[4] http://www.cnblogs.com/heaad/archive/2011/01/02/1924195.html