Reference documents:
1. Cuckoo Filter hash algorithm
2, Cuckoo hash
Use:
Cuckoo hash (cuckoo hash). Asked to solve the problem of the conflict with Kazakhstan, the use of less computation in exchange for larger space. Small footprint, fast query speed. Often used in bloom filter and memory management. The reason for this name is because the cuckoo nature greed, not to build their own nests, but in other nests inside the bird eggs hatch, the first growth of the young birds will be other bird eggs out, so that the exclusive "motherly Love", similar to the hash conflict processing process.
Algorithm Description :
Use Hasha, HASHB to calculate the corresponding key position:
1, two positions are empty, then select one insert;
2, two position one is empty, then insert to the empty location
3, two positions are not empty, then kicked out a position after inserting, kicked out of the <key,value> to call the algorithm, and then execute the algorithm to find another location, loop until the insertion succeeds.
If the number of kicks has reached a certain threshold, the hash table is considered full and re-hashed rehash
Optimization (reduced hash collisions):
1, the one-dimensional conversion to multidimensional, using buckets (buckets) of the 4-way slot (slot);
2, a key corresponding to multiple value;
3, increase the hash function, from two to more;
4, increase the hash table, similar to the first;
Cuckoo Hash--hash conflict Resolution