Add methods to count collisions to the hash set in Section 16.4.5 and the one in Exercise

Question:

Add methods to count collisions to the hash set in Section 16.4.5 and the one in Exercise • E16.20 . Insert all words from a dictionary (in /usr/share/dict/words or in words.txt in your companion code) into both hash set implementations. Does the MAD method reduce collisions? (Use a table size that equals the number of words in the file. Choose p to be the next prime greater than L, a = 3, and b = 5.)

Data from exercise E16.20 

Implement the hash set in Section 16.4.5, using the “MAD (multiply-add-divide)
method” for hash code compression. For that method, you choose a prime number p larger than the length L of the hash table and two values a and b between 1 and p – 1.
Then reduce h to |((a h +b) % p) % L|.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question
Question Posted: