Cuckoo Hash--hash conflict Resolution

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.