Skip to content

Lecture 9 on 02/25/2026 - Chernoff Bounds and Hashing with Chaining

  • Chernoff bounds for sums of independent Bernoulli random variables
  • Expectation and concentration (tail bounds intuition)
  • Applying Chernoff bounds to hashing with chaining
  • High-probability guarantees on bucket sizes (chain lengths)

Let X1,X2,,XnX_1, X_2, \dots, X_n be independent Bernoulli random variables, where

Xi={1with probability pi0with probability 1piX_i = \begin{cases} 1 & \text{with probability } p_i \\ 0 & \text{with probability } 1 - p_i \end{cases}

Define the sum

X=_i=1nXi.X = \sum\_{i=1}^{n} X_i.

This represents the number of successes (e.g., heads in nn biased coin tosses).

By linearity of expectation,

μ=E[X]=i=1nE[Xi]=i=1npi.\mu = \mathbb{E}[X] = \sum*{i=1}^{n}\mathbb{E}[X_i] = \sum*{i=1}^{n} p_i.

The Chernoff bounds apply because the variables X1,,XnX_1,\dots,X_n are independent. Independence is essential for obtaining strong concentration guarantees.

The goal is to bound the probability that XX deviates significantly from its expectation μ\mu (tail probabilities). Chernoff bounds provide exponentially small probabilities for large deviations.

For δ>0\delta > 0,

Pr[X(1+δ)μ]exp ⁣(δ2μ3).\Pr\bigl[X \ge (1+\delta)\mu\bigr] \le \exp\!\left(-\frac{\delta^2 \mu}{3}\right).

For 0<δ<10 < \delta < 1,

Pr[X(1δ)μ]exp ⁣(δ2μ2).\Pr\bigl[X \le (1-\delta)\mu\bigr] \le \exp\!\left(-\frac{\delta^2 \mu}{2}\right).

These inequalities show that XX is highly concentrated around its expectation μ\mu. As μ\mu grows, the probability of large deviations decreases exponentially.

Intuitively, although each trial is random, averaging many independent trials makes extreme outcomes extremely unlikely.

An event occurs with high probability if it happens with probability at least 11/n1 - 1/n (or another quantity approaching 11 as nn grows).

We hash nn elements into mm buckets using a random hash function, where each element independently lands in any bucket with probability 1/m1/m.

Fix a particular bucket. For each element ii, define

Xi={1if element i hashes to the bucket0otherwise.X_i = \begin{cases} 1 & \text{if element $i$ hashes to the bucket} \\ 0 & \text{otherwise}. \end{cases}

Then the bucket size is

X=_i=1nXi.X = \sum\_{i=1}^{n} X_i.

Since Pr[Xi=1]=1/m\Pr[X_i = 1] = 1/m, we obtain

μ=E[X]=nm.\mu = \mathbb{E}[X] = \frac{n}{m}.

The quantity nm\frac{n}{m} is called the load factor (expected chain length).

Because the bucket size is a sum of independent Bernoulli indicator variables, Chernoff bounds can be applied directly to analyze load balance.

Using the upper-tail Chernoff bound,

Pr[X(1+δ)μ]exp ⁣(δ2μ3).\Pr\bigl[X \ge (1+\delta)\mu\bigr] \le \exp\!\left(-\frac{\delta^2 \mu}{3}\right).

Thus, the probability that a bucket becomes much larger than its expected size decreases exponentially in μ\mu.

From One Bucket to All Buckets (Union Bound)

Section titled “From One Bucket to All Buckets (Union Bound)”

The Chernoff bound controls the size of a fixed bucket. To guarantee that no bucket becomes too large, we apply a union bound over all mm buckets.

This shows that with high probability, every bucket size remains close to its expectation.

A classical result states that when nn elements are hashed into nn buckets, the maximum bucket size is

O ⁣(lognloglogn)with high probability.O\!\left(\frac{\log n}{\log\log n}\right) \quad \text{with high probability}.

This implies that hashing with chaining supports operations in nearly constant time with high probability.

With high probability:

  • Bucket sizes remain close to the expected load nm\frac{n}{m}
  • Very long chains are unlikely
  • Hash table operations (search, insert, delete) remain efficient

Chernoff bounds are a central tool in analyzing randomized algorithms and data structures. They show strong concentration for sums of independent random variables and provide high-probability guarantees, such as bounding chain lengths in hashing with chaining.

Randomized algorithms often achieve near-deterministic performance: undesirable outcomes occur only with exponentially small probability.