|
ADS
Algorithms and Data Structures
|
The filter of Bloom, beyond the book: a set that may answer yes for an item it does not hold, but never no for one it holds, in \( m \) bits whatever the items. More...
#include "ADS/Contract.h"#include "ADS/dictionary/RandomHashing.h"#include "ADS/external/MappedFile.h"#include <cmath>#include <cstddef>#include <cstdint>#include <functional>#include <string_view>#include <vector>#include "ADS/set/impl/BloomFilter.tpp"Go to the source code of this file.
Classes | |
| class | ADS::BloomFilter< T, H > |
| a filter of Bloom of \( m \) bits and \( k \) hashes More... | |
Namespaces | |
| namespace | ADS |
The filter of Bloom, beyond the book: a set that may answer yes for an item it does not hold, but never no for one it holds, in \( m \) bits whatever the items.
An item sets the \( k \) bits \( h_1 + i h_2 \bmod m \), \( i = 0 , \ldots , k - 1 \), of two hashes, as Kirsch and Mitzenmacher showed to be as good as \( k \) independent hashes, and is maybe there if all its bits are set; after \( n \) insertions the probability of a false positive is about \( ( 1 - e^{-k n / m} )^k \), the least for \( k = ( m / n ) \ln 2 \), i.e., about \( 0.6185^{m/n} \) (\( 1 \% \) with about 9.6 bits per item). The two hashes come from the hash of the item mixed by splitmix64() [see RandomHashing.h].
The contracts [see Contract.h]: \( m \ge 1 \) and \( k \ge 1 \); an item inserted is always maybe there. The operations are defined in BloomFilter.tpp.