
Suppose there is an open (external) hash table with four buc...
Prompt
Suppose there is an open (external) hash table with four buckets, numbered 0,1,2,3, and integers are hashed into these buckets using hash function h(x) = x mod 4. If the sequence of perfect squares 1,4,9, ... , i^2, ... is hashed into the table, then, as the total number of entries in the table grows, what will happen? A) Two of the buckets will each get approximately half the entries, and the other two will remain empty. B) All buckets will receive approximately the same number of entries. C) All entries will go into one particular bucket. D) All buckets will receive entries, but the difference between the buckets with smallest and largest number of entries will grow.
Answer guidance
Correct answer: A) Two of the buckets will each get approximately half the entries, and the other two will remain empty.