Expected Fingerprint Collisions Among Cache Keys
Last updated: November 29, 2026
Quick Overview
A cache stores 100,000 keys by a 32-bit hash fingerprint. Assuming a uniform hash, how many pairs of keys are expected to share a fingerprint, and what is the probability of no collision at all? How many bits would make the collision probability below one in a million?
Meta
November 29, 20260
0
0 solved
A cache stores 100,000 keys by a 32-bit hash fingerprint. Assuming a uniform hash, how many pairs of keys are expected to share a fingerprint, and what is the probability of no collision at all? How many bits would make the collision probability below one in a million?
Meta runs massive caching layers where keys are often compared by fingerprint. Interviewers ask this to check that a systems candidate can do birthday-bound arithmetic quickly and turn it into a design decision about hash width.
What the Interviewer Expects
- Use indicators over pairs: $E = \binom{m}{2}/N$
- Compute about 1.16 expected colliding pairs
- Approximate $P(\text{none}) \approx e^{-m^2/2N} \approx 0.31$
- Solve for bits: about 53 to 54 bits for one in a million
- Recommend 64-bit fingerprints or verifying full keys
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- How does the answer change at 10 billion keys?
- What is the expected number of empty buckets for a hash table with as many buckets as keys?
- How would you verify that a hash function is close to uniform?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
keys, each hashed uniformly and independently to values. A collision is a pair with equal fingerprints....
Approach
Use an indicator for each pair: . Linearity gives the expected count. Since collisions are rare and nearly independent, the count is close to Poisson, which gives the pr...