All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2022 Shift 1

Suppose we store n keys in a hash table of size m = n² using a hash function h chosen randomly from a universal class of hash functions. Then the probability that there are any collisions is ______

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. less than 1/2

Explanation

The expected number of colliding pairs is C(n,2)/n² < 1/2, so by Markov's inequality P(any collision) < 1/2 (CLRS perfect hashing).

More Data Structures and Algorithms questions