Assume that you are hashing key K to a hash table of n slots (indexed from 0

Question:

Assume that you are hashing key K to a hash table of n slots (indexed from 0 to n - 1). For each of the following functions h(K), is the function acceptable as a hash function (i.e., would the hash program work correctly for both insertions and searches), and if so, is it a good hash function? Function Random(n) returns a random integer between 0 and n - 1, inclusive.

(a) h(k) = k=n where k and n are integers.

(b) h(k) = 1.

(c) h(k) = (k + Random(n)) mod n.

(d) h(k) = k mod n where n is a prime number.

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

Step by Step Answer:

Question Posted: