Open In App
Related Articles

Data Structures | Hash | Question 5

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Which of the following hash functions is most likely to cause clustering in a hash table?

(A)

h(k) = k % m

(B)

h(k) = floor(m * (kA mod 1))

(C)

h(k) = k

(D)

h(k) = ((k / m) + k * m) + k % m



Answer: (A)

Explanation:

The modulo operation in option a) results in clustering since the hash values of keys that are close to each other will also be close, leading to collisions. Options B, C, and D use more complex hash functions, which spread out the keys more uniformly across the table..



Quiz of this Question
Please comment below if you find anything wrong in the above post

Last Updated : 20 May, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads