I have already introduced D-left hashing in the previous article. I will not talk about it more here. As mentioned above, D-left hashing is used to solve the Load Balancing Problem of hash tables. To understand how D-left hashing solves this problem, let's first look at the absence of D-left hashing. The same hash value is used as the address at the high position as the fingerprint, which means that the same address corresponds to multiple fingerprints. One address corresponds to one bucket, so one bucket needs to store multiple fingerprints. The hash value distribution of a single hash function is uneven, and the load of each bucket is not balanced. If the number of fingerprint files that each bucket can store is fixed, you must allocate the bucket capacity according to the worst case to avoid overflow, which leads to a great waste.
After D-left hashing is used, the distribution of fingerprint is relatively balanced, which greatly reduces the waste of space. It turns out that even if a large hash table is allocated, it is difficult to reduce the bucket capacity due to the worst case allocation, and a large amount of space in the hash table is idle. The use of D-left hashing can make the stored information evenly and more compact, so that the same amount of information can be stored in a smaller space. In perfect hashing. as mentioned in the bloom filter article, the D-left counting bloom filter can save at least twice as much space as the counting bloom filter because the load of the counting bloom filter is not balanced, A lot of space is wasted.
From another perspective, D-left hashing is actually a perfect hash function. If the original load is not balanced, the collision is very serious. After D-left hashing is used, the collision is greatly reduced. Of course, it cannot completely eliminate collision, so it just simulates the perfect hash function in a way with a low overhead, which can be called almost-perfect hash function.