Question: Problem 2. As you know, when implementing a hash table, we normally have hash collisions where multiple elements have the same hash value. Thus, we

 Problem 2. As you know, when implementing a hash table, we

Problem 2. As you know, when implementing a hash table, we normally have hash collisions where multiple elements have the same hash value. Thus, we should try to choose such a hash function that will not result in too many collisions. Suppose you have an empty hash table of length 13 with hash function h(x)=x mod n Initially n was chosen to be equal to 13 a) How many collisions will be in the hash table for the following dataset: 14, 27, 40,53, 66,79,92,105, 118, 131,144? b) Can you come up with another n for which the function h(r)r mod n produces no collisions for this dataset without increasing the size of the hash table? If your answer is "yes", give the value of n and explain why there are no collisions f your answer is "no", explain why it is impossible to do c) Propose a function different from h(x)-r mod n which produces no collisions for our dataset

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!