Practice Discrete Math

Algorithms / Hashing Randomization

Least You Need to Know: Hashing, Randomization, and Collision Analysis

Hashing analysis often studies expected collisions, load, and robustness against bad input patterns. Randomized hashing spreads keys more evenly in expectation, and universal-hashing-style ideas show why randomization can protect performance from adversarial structure.

The least you need to know

Key notation

collision two or more keys mapping to the same bucket
load factor `alpha` ratio of stored keys to available buckets or slots
universal hashing a randomized family of hash functions with collision guarantees for fixed key pairs

Tiny worked example

  • Suppose `n` keys are hashed into `m` buckets.
  • The average load factor is `alpha = n/m`.
  • To study expected collisions, define an indicator for each pair of keys landing in the same bucket.
  • Summing expectations gives the expected total number of collisions.

Common mistakes

How to recognize this kind of problem

Start practice