santoshvijapure / DS_with_hacktoberfest

Celebrate Hacktoberfest by getting involved in the open source community by completing some simple tasks in this project.
Apache License 2.0
10 stars 95 forks source link

Double Hashing #236

Closed mehrajcode closed 3 years ago

mehrajcode commented 3 years ago

Double hashing is a collision resolving technique in Open Addressed Hash tables. Double hashing uses the idea of applying a second hash function to key when a collision occurs.

First hash function is typically hash1(key) = key % TABLE_SIZE

A popular second hash function is : hash2(key) = PRIME – (key % PRIME) where PRIME is a prime smaller than the TABLE_SIZE.

A good second Hash function is:

It must never evaluate to zero
Must make sure that all cells can be probed

Checklist

Pick at least one of the three options