|
ADS
Algorithms and Data Structures
|
Universal hashing, beyond the book. More...
Files | |
| file | ADS/dictionary/UniversalHashing.h |
| Universal hashing, beyond the book [see HashFunctions.h for the fixed functions of section 7.1]: a class \( H \) of functions \( U \rightarrow \{ 0 , \ldots , m - 1 \} \) is universal if two distinct keys collide under at most \( | H | / m \) of its functions, and \( c \)-universal if under at most \( c | H | / m \); a function drawn at random from it gives every set of keys the expected lists of length \( 1 + \alpha \) of the simple uniform hashing, \( \alpha = n / m \), and the longest of them is \( O( \log n / \log \log n ) \) in expectation when \( m = \Theta( n ) \), whatever the keys, while for every fixed function there are \( n \) keys that fall in one list. | |
Classes | |
| class | ADS::CarterWegmanHash |
| \( h( k ) = ( ( a k + b ) \bmod p ) \bmod m \), of the class \( H_{p,m} \) of Carter and Wegman More... | |
| class | ADS::DotProductHash |
| \( h( k ) = \sum_i a_i k_i \bmod m \), the \( k_i \) being the digits of \( k \) in base \( m \) More... | |
| class | ADS::MultiplyShiftHash |
| \( h( k ) = ( a k \bmod 2^h ) \operatorname{div} 2^{h - l} \), with \( a \) odd More... | |
| class | ADS::StringHash |
| \( h( s ) = \sum_i ( s_i + 1 ) x^i \bmod ( 2^{61} - 1 ) \), at a random point \( x \) More... | |
| class | ADS::MultiplicativeHash< K, Code > |
| the multiplicative hashing of section 5.1.1 of Morin's book, \( \mathrm{hash}( x ) = ( z x \bmod 2^w ) \operatorname{div} 2^{w-d} \) on a table of \( 2^d \) places, \( z \) a random odd word and \( x \) the hash code Code( k ) of the key More... | |
| class | ADS::CompoundHash |
| the hash code of an object of \( r \) parts of section 5.3.2 of Morin's book, \( h( x_0 , \ldots , x_{r-1} ) = ( ( z \sum_i z_i x_i ) \bmod
2^{2w} ) \operatorname{div} 2^w \) with \( w = 64 \), the \( z_i \) random words and \( z \) a random odd integer of \( 2 w \) bits: two distinct tuples collide with probability at most \( 3 / 2^w \) (Theorem 5.3 of Morin's book), where the XOR or the sum of the parts make large sets of tuples collide (exercises 5.7 to 5.9) More... | |
| class | ADS::SequenceHash |
| the hash code of the arrays and of the strings of section 5.3.3 of Morin's book, a polynomial over the prime field of \( p = 2^{61} - 1 \) with an end marker, \( h( x_0 , \ldots , x_{r-1} ) = ( \sum_i x_i z^i + ( p - 1 ) z^r )
\bmod p \) More... | |
| class | ADS::DLeftHashTable< K, V, H > |
| a DICTIONARY on \( d \) tables of lists, a key in the shortest of its \( d \) lists More... | |
Universal hashing, beyond the book.
The definitions, the invariants and the costs of the area are in Theory of dictionaries.