---
title: Linear Hashing
url: https://www.emergentmind.com/topics/linear-hashing
type: topic
---

# Linear Hashing

Linear hashing denotes several distinct families and mechanisms in hashing theory. In database systems, *linear hashing* is a dynamic file-expansion scheme based on incremental bucket splitting; in classical data structures, the term is also used for linear probing, an open-addressing collision-resolution method. In theoretical computer science, it commonly refers to compact algebraic hash families such as affine modular hashing, $h(x)=((ax+b)\bmod p)\bmod m$, or random linear maps over finite fields. Related uses include linear sketching, supervised linear hashing of feature vectors, and linear-code hashing for randomness extraction. These notions share linear or affine algebraic structure but have different models, guarantees, and unresolved problems.

## 1. Terminology and mathematical models

### Affine modular hashing

The canonical affine modular family chooses a prime $p$, random parameters $a,b\in\mathbb F_p$, and maps keys to $m$ buckets by

$$
h_{a,b}(x)=((ax+b)\bmod p)\bmod m.
$$

The first operation is affine over $\mathbb F_p$; the final reduction modulo $m$ generally is not a field operation. For a key set $X$ of size $n$, the maximum load is

$$
\operatorname{ML}(h,X)=\max_{r\in[m]}|\{x\in X:h(x)=r\}|.
$$

The standard worst-case question maximizes $\mathbb E_{a,b}[\operatorname{ML}(h,X)]$ over fixed, adversarially chosen sets $X$. The family is compact—its seed requires $O(\log p)$ bits—and evaluation takes constant time. Before final range reduction, the affine maps form a pairwise-independent, $2$-universal family; after reduction, bin marginals are only nearly uniform, although distinct-key collision probabilities remain $O(1/m)$ [2608.24866].

Two representations are frequently distinguished. *Strided* hashing uses reduction modulo $m$, whereas *blocked* hashing partitions $[0,p)$ into consecutive intervals of length approximately $p/m$. In the standard prime-modulus setting, their expected maximum loads differ by at most a factor of $2$. Removing the additive shift produces *Simple Linear Hashing*, which is likewise equivalent up to constant factors in the relevant prime-modulus analysis [2307.13016].

### Binary linear hashing

A different family chooses a uniformly random linear map

$$
h:\mathbb F_2^u\longrightarrow\mathbb F_2^\ell,
\qquad n=2^\ell,
$$

represented by an $\ell\times u$ random binary matrix. The $n$ bins are the elements of $\mathbb F_2^\ell$. For a fixed set $S\subseteq\mathbb F_2^u$ with $|S|=n$,

$$
M(S,h)=\max_{y\in\mathbb F_2^\ell}|h^{-1}(y)\cap S|.
$$

The fibers of a surjective map are affine cosets of a random $(u-\ell)$-dimensional kernel. Although this family is universal and has strong algebraic dependencies—it is not even $3$-wise independent—the maximum-load behavior is optimal up to the leading and dominant second-order terms [2505.14061; 2605.18335].

This result should not be conflated with the affine modular family. The former is linear as a map between vector spaces over $\mathbb F_2$; the latter applies an affine finite-field transformation followed by an incompatible reduction modulo an arbitrary bucket count. Their maximum-load behavior is now known to be substantially different.

### Linear probing

Linear probing is an open-addressing method rather than a hash-family specification. A key whose home location is $h(x)$ scans

$$
h(x),h(x)+1,h(x)+2,\ldots\pmod m
$$

until it finds the key, an empty location, or the first available location for insertion. The cost of an operation is controlled by the occupied run containing the home location. Under fully random hashing, or under suitable limited-independence assumptions, this produces a cluster-based performance problem distinct from maximum bin load.

The term *linear hashing* in linear-probing papers therefore denotes a collision-resolution process, not necessarily an affine hash family. Dynamic Linear Hashing, in turn, is a database scheme based on incremental bucket splitting and is a third, unrelated usage [1410.5967; 1808.04602].

## 2. Linear probing, clusters, and operational cost

For bucket capacity $b$, a table consists of $m$ cyclically ordered buckets, each holding at most $b$ keys. If $X_i$ is the number of keys whose home address is bucket $i$, $H_i$ the number trying bucket $i$, $Q_i$ the overflow passed to bucket $i+1$, and $Y_i$ the final occupancy, then

$$
H_i=X_i+Q_{i-1},\qquad Q_i=(H_i-b)_+,\qquad Y_i=\min(H_i,b).
$$

The load factor is $\alpha=n/(bm)$). In the Poisson model, the home occupancies are independent with

$$
X_i\sim\operatorname{Poisson}(b\alpha).
$$

The overflow profile is a reflected random walk with increments $X_i-b$. Its drift is $-b(1-\alpha)$, negative whenever $\alpha<1$. This representation connects local occupancy, cluster formation, overflow, and search cost.

A cluster, or block, is a maximal sequence of full buckets followed by a non-full bucket. If $B$ is the block length in the one-sided infinite model, then

$$
B=\min\{i\ge1:S_i'<0\},
\qquad
S_i'=\sum_{k=1}^i(X_k-b).
$$

The probability-generating function is

$$
\psi_B(q)=1-\frac{1-\zeta_0(q)}{1-\alpha},
$$

where $\zeta_0(q)=T(q^{1/b}e^{-\alpha})$ on the specified branch of the tree function $T(z)=ze^{T(z)}$. The mean block length satisfies

$$
\mathbb E B=\frac1{T_0(b\alpha)},
$$

where $T_0(b\alpha)$ is the limiting probability that a bucket is non-full. A uniformly selected bucket sees a size-biased block distribution, so the block containing a random bucket is not distributed like a randomly selected block.

For unsuccessful search, $U$ denotes the number of full buckets inspected. Its tail is the residual-block relation

$$
\Pr(U=k)=\Pr(B>k).
$$

The total number of inspected buckets is $U+1$. For first-come-first-served insertion, the displacement of a newly inserted key equals $U$. The expected displacement of a random stored key is policy-independent because the total displacement equals the total bucket overflow:

$$
\mathbb E D_{m,n}=\frac{m}{n}\mathbb E Q_{m,n}.
$$

This conservation identity applies to FCFS, LCFS, Robin Hood, and other insertion policies, although their displacement distributions and variances differ.

The classical bucket-size-one case, $b=1$, gives ordinary linear probing. For fixed $\alpha<1$, expected search costs remain bounded as the table grows, but the constants diverge as $\alpha\uparrow1$. At full occupancy, the behavior changes qualitatively: total displacement has order $m^{3/2}$ and converges after normalization to the area under a standard Brownian excursion. Near full occupancy, long clusters and finite-size effects dominate fixed-load asymptotics [1410.5967; 1603.02235].

## 3. Independence requirements and deletion without relocation

The quality of linear probing depends not only on the collision-resolution rule but also on the hash family. A hash function is $k$-independent if the hash values of every $k$ distinct keys are mutually independent and individually uniform. A random degree-$(k-1)$ polynomial over a prime field supplies a standard construction.

Five-wise independence is sufficient for expected constant-time search, insertion, and deletion when the load is bounded away from one. The proof conditions on the query hash value; the remaining stored-key indicators are then $4$-wise independent. A fourth-moment bound shows that a dyadic interval of length $2^\ell$ is near-full with probability $O(2^{-2\ell})$. Summing over dyadic scales yields expected occupied-run length $O(1)$, and hence expected $O(1)$ operation cost. The simplified theorem assumes $t\ge3n$, or $\alpha\le1/3$, while the sharper statement gives expected cost $O(1/\varepsilon)$ at load $1-\varepsilon$ [1509.04549].

Four-wise independence does not suffice in general. Simple tabulation hashing, although formally only $3$-independent, can satisfy the relevant fourth-moment estimate after conditioning. By contrast, ordinary affine transformations can generate pathological clustering. These guarantees are expectations over the randomly selected hash function and do not imply a simultaneous high-probability bound for every key and every operation.

A separate variant addresses deletion under referential integrity. Ordinary backward shifting preserves probe reachability by moving subsequent elements, but invalidates pointers to their table locations. The tombstone-minimizing variant never moves live elements. Each slot is logically one of `EMPTY`, `TOMBSTONE`, or `LIVE`. A tombstone is retained only if a surviving element’s probe path requires it; otherwise it is changed to empty during deletion. This maintains search correctness while preserving references.

The structural guarantees are local: every retained tombstone has a live witness, and every removed tombstone is unnecessary for the current set of live elements. Deletion may scan a substantial cluster and can take $O(m)$ time in the worst case. The reported bounded long-run search overhead is experimental rather than a formal amortized theorem; no worst-case bound on tombstone counts or deletion cost is established. Ordinary resizing remains problematic because rehashing changes element addresses [1808.04602].

## 4. Hashing with chaining and affine arithmetic structure

Affine modular hashing is often used with separate chaining rather than linear probing. In that setting, the load of a bucket is exactly its chain length, and the maximum load is the longest chain. The family

$$
h(x)=((ax+b)\bmod p)\bmod m
$$

uses only two random parameters, so outputs are highly dependent. For $m=n$, fully random hashing has expected maximum load $\Theta(\log n/\log\log n)$, whereas the previously known upper bound for affine modular hashing was $\widetilde O(n^{1/3})$. A 2017 analysis established

$$
\mathbb E[M(h,X)]=O((n\log n)^{1/3})
$$

for fixed key sets, improving generic $O(\sqrt n)$ bounds for broad $2$-independent families [1706.02783].

The proof converts a heavy bucket into a short interval containing many transformed keys. Carefully selected multipliers, often indexed by primes, force many pairs of original keys to have unusually small modular differences. A technical interval-overlap lemma supplies a lower bound on such pairs, while random multiplication gives an upper bound for each fixed pair. The resulting tail estimate has cubic decay,

$$
\Pr[M\ge4\alpha]=O\!\left(\frac{n\log n}{\alpha^3}\right),
$$

which integrates to the cube-root expected maximum-load bound.

Composite moduli require additional care because nonzero elements need not be invertible. Smart Linear Hashing chooses multipliers from $\mathbb Z_m^\times$. For ordinary composite hashing, conditioning on $d=\gcd(a,m)$ partitions the input into components corresponding to Smart Linear Hashing modulo $m/d$. The resulting loss is bounded by the divisor function

$$
\tau(m)=m^{o(1)}.
$$

Blocked and strided variants, real multipliers, random moduli, and the two-bin case are closely related, but the equivalences preserve only specified approximation factors or asymptotic orders [2307.13016].

## 5. Optimality and failure of different linear families

Binary linear hashing has a markedly stronger theorem. For every fixed $S\subseteq\mathbb F_2^u$ with $|S|=n=2^\ell$, a uniformly random linear map satisfies

$$
\mathbb E_h[M(S,h)]
\le
\left(1+o(1)\right)\frac{\log n}{\log\log n}
+
(1+o(1))
\frac{\log n\log\log\log n}{(\log\log n)^2}.
$$

In particular, its leading term matches fully independent hashing, whose expected maximum load is

$$
(1+o(1))\frac{\log n}{\log\log n}.
$$

The proof exposes the random kernel one dimension at a time. If $V_i$ is the partial kernel and $S_i(x)=|(x+V_i)\cap S|$, define the exponential potential

$$
\Phi_i=\mathbb E_x[b^{S_i(x)}].
$$

The central inequalities are

$$
\mathbb E[\Phi_{i+1}\mid \Phi_0,\ldots,\Phi_i]\le\Phi_i^2
$$

and

$$
\Phi_{i+1}-1\ge2(\Phi_i-1).
$$

The first controls conditional growth under pairwise coset mergers; the second gives deterministic excess-potential doubling. Optimizing the base $b$ according to the target load yields a refined tail bound. For $R>1$ satisfying the stated threshold condition,

$$
\Pr\!\left[
M(S,h)\ge R\frac{\log n}{\log\log n}
\right]
\le
O\!\left(
\frac{(\log\log n)^2}
{R^2(\log n)^{2-2/R}}
\right).
$$

A 2026 refinement integrates this optimized tail to recover the dominant second-order correction, showing that binary linear hashing nearly matches fully independent hashing beyond the leading scale [2505.14061; 2605.18335].

Affine modular hashing has a different status. Recent arithmetic-combinatorial constructions produce, for $m=\Theta(n)$ and sufficiently large prime modulus, an $n$-element key set with expected maximum load

$$
\exp\!\left(\Omega\!\left(\frac{\log n}{\log\log n}\right)\right)
=
n^{\Omega(1/\log\log n)}.
$$

In one formulation, the same key set causes this load for every affine multiplier, not merely in expectation. The construction uses small sets containing long arithmetic progressions in many differences. Under a real multiplier, two of the points $a,2a,\ldots,Da$ must be close on the unit circle; a progression with that difference is consequently compressed into an interval meeting at most two bins. A reduction transfers this phenomenon to modular hashing [2608.24866; 2608.23502].

The lower bound is super-polylogarithmic but subpolynomial. Thus, for affine modular hashing with $m=\Theta(n)$, the current gap is between

$$
\exp\!\left(\Omega\!\left(\frac{\log n}{\log\log n}\right)\right)
$$

and approximately

$$
n^{1/3+o(1)}.
$$

This contrasts directly with binary random linear hashing: “linear hashing is optimal” applies to the binary vector-space family, not to the canonical affine modular family.

## 6. Arithmetic Kakeya connections and open problems

The affine modular maximum-load problem admits a density arithmetic Kakeya formulation. For $X\subseteq\mathbb F_p$, define the richness in direction $d$ at progression length $L$ by

$$
R_{X,L}(d)=
\max\{|J|:c+dJ\subseteq X,\ J\subseteq[L]\}.
$$

With $L=\lceil p/m\rceil$ and $d_a=ma^{-1}\pmod p$, the maximum load and directional richness satisfy

$$
\frac12R_{X,L}(d_a)
\le
\operatorname{ML}(h_{a,b},X)
\le
R_{X,L}(d_a).
$$

Therefore, constructing key sets with large rich progressions in many directions constructs bad hashing inputs. Green–Ruzsa constructions supply relatively small sets containing long arithmetic progressions for every difference in an initial interval. Difference amplification converts these progressions into rich subsets for a constant fraction of modular directions, yielding the super-polylogarithmic lower bound [2608.23502].

The same viewpoint applies to real linear hashing,

$$
h_a(x)=\lfloor n\{ax\}\rfloor.
$$

If a set contains a $k$-term progression for every difference $d\in[D]$ with $D\ge kn$, then for every real seed $a$ two of $a,2a,\ldots,Da$ lie within circular distance $1/D$. The corresponding progression is mapped into an interval of length less than $1/n$, so at least $k/2$ keys occupy one bin. This gives a pointwise, every-seed lower bound.

The arithmetic Kakeya connection also yields conditional barriers. A uniform $n^{o(1)}$ upper bound for real or modular linear hashing over polynomial-size universes would imply the polynomial-length arithmetic Kakeya conjecture, which in turn implies the Kakeya conjecture for upper Minkowski dimension. Conversely, any substantial improvement over the cube-root upper bound would imply new results for arithmetic Kakeya-type sets. The current lower-bound construction does not establish a polynomial lower bound; whether the true worst-case expected load is $n^c$ for some absolute $c>0$ remains open [2608.23502; 2608.24866].

Other linear-hashing applications pose different questions. In supervised discrete hashing, S2DHMLR learns a linear feature-to-code map

$$
\mathbf h_i=\operatorname{sgn}(\mathbf P^T\mathbf v_i),
$$

while using a single shared projection $\mathbf W$ for code-to-label and label-to-code regression. Its optimization combines discrete binary codes, mutual regression, feature regression, alternating minimization, Sylvester-equation solution, and discrete cyclic coordinate descent. Experiments on CIFAR-10, MS-COCO, and NUS-WIDE report improved mean average precision relative to several supervised linear baselines, with a boosting procedure selecting balanced bits [1904.00744].

In randomized numerical linear algebra, hashing matrices provide sparse subspace embeddings. An $s$-hashing matrix has $s$ signed nonzeros per column, each of magnitude $1/\sqrt{s}$. For sufficiently low coherence, sketch dimension $m=O(r)$ is possible, where $r$ is the input rank. Increasing $s$ permits coherence larger by approximately $\sqrt{s}$; randomized Hadamard preprocessing further reduces coherence. These embeddings yield well-conditioned preconditioners for linear least squares, implemented in Ski-LLS for dense and sparse problems [2105.11815].

Finally, linear-code hashing uses a parity-check matrix $H$ to map $Z\in\mathbb F_q^n$ to its syndrome $HZ$. For integer $p\ge2$, a random linear code extracts nearly uniform $q$-ary symbols when

$$
m\le H_p(Z)-p-\log_q(1/\epsilon),
$$

with an ensemble-average Rényi-divergence and normalized $l_p$ guarantee. Reed–Muller parity-check matrices achieve the full $p$-Rényi intrinsic-randomness rate for memoryless Bernoulli sources, while the corresponding full Shannon-order claim remains unresolved [2405.04406]. These extraction, sketching, supervised-retrieval, chaining, probing, and algebraic-load problems all use “linear hashing,” but their objectives—uniformity, embedding, semantic similarity, operation cost, or maximum occupancy—are mathematically distinct.

Source: https://www.emergentmind.com/topics/linear-hashing