arXiv:2610.33229cs.DSOct 2026

Manuscript Offprint

arXiv:2610.33229

Optimal Worst-Case Open Addressing: Braided Cuckoo Hashing

Andrew Krapivin, William Kuszmaul

Abstract

In this paper, we introduce braided cuckoo hashing, an open-addressed hash table that supports load factor up to 1−ε1 - \varepsilon (for some parameter ε∈(0,1)\varepsilon \in (0,1)), while supporting queries, insertions, and deletions in worst-case time O(log⁡ε−1)O(\log \varepsilon^{-1}), with high probability. This result represents an exponential improvement on insertion/deletion time over previous constructions, and disproves a conjecture of Bender, Kuszmaul, and Zhou that the product of worst-case query time and expected insertion/deletion time must be Ω(ε−1)\Omega(\varepsilon^{-1}).

1 Introduction

First popularized in the early 2000s [PR01, FPSS05, DW07], cuckoo hashing is a method of implementing an open-addressed hash table with worst-case time bounds for queries. In its simplest form, cuckoo hashing maintains the invariant that each element xx is in one of two random slots h1(x)∈[1,m/2]h_1(x) \in [1, m/2] and h2(x)∈(m/2,m]h_2(x) \in (m/2, m] in an array of size mm. To query whether an element xx is present, one simply checks the slots h1(x)h_1(x) and h2(x)h_2(x). To insert an element xx, one performs a kickout chain, placing xx in position h1(x)h_1(x), evicting any element x′x' in position h1(x)h_1(x) to its other viable slot h2(x′)h_2(x'), evicting any element x′′x'' in position h2(x′)h_2(x') to its other viable slot h1(x′′)h_1(x''), and so on, until the chain terminates at a free slot. Finally, to delete an element xx, one simply removes it from the table.

It is not clear, a priori, whether insertions in a cuckoo hash table should even succeed. (The eviction chain might enter an infinite loop.) However, in a celebrated result of Pagh and Rodler [PR01], it was shown that, so long as the hash table is less than a 1/2−Ω(1)1/2 - \Omega(1) fraction full, each insertion succeeds with probability 1−O(1/n2)1 - O(1/n^2), and the expected insertion time is O(1)O(1).

To support higher load factors, researchers have considered extensions of cuckoo hashing in which each query checks d>2d > 2 slots h1(x),…,hd(x)h_1(x), \ldots, h_d(x) in the hash table. These slots can be selected in a variety of ways, for example by using dd independent hash functions h1,…,hdh_1, \ldots, h_d [FPSS05], by breaking slots into buckets and hashing to buckets whose sizes sum to dd [DW07], or by other more elaborate schemes [FPSS05, ANS09, KMW10, BCFC +^+23, Wal23]. To support load factor 1−ε1 - \varepsilon, the optimal value of dd, and indeed the optimal worst-case query time in any open-addressed hash table, is known to be Θ(log⁡ε−1)\Theta(\log \varepsilon^{-1}).

This raises a natural question: If we wish to support worst-case query time Θ(log⁡ε−1)\Theta(\log \varepsilon^{-1}), what is the best insertion/deletion time that we can hope for? Early work on this question [FPSS05, DW07] led to bounds which were super-polynomial in ε−1\varepsilon^{-1} (and in some cases, a function of nn [FMM09, FPS13]), but conjectured that a bound of the form O(ε−1)O(\varepsilon^{-1}) should be possible [FPSS05, DW07]. This was finally achieved in 2025 by Kuszmaul and Mitzenmacher [KM25], who showed how to achieve an expected insertion/deletion time of O(ε−1)O(\varepsilon^{-1}).

*Carnegie Mellon University (andrew@krapivin.net).

†^{\dagger}Carnegie Mellon University (kuszmaul@cmu.edu).

There is good reason to believe, intuitively, that a bound of O~(ε−1)\tilde{O}(\varepsilon^{-1}) should be optimal. Consider, in particular, a long-running workload that alternates between insertions and deletions at load factor 1−ε1 - \varepsilon. To a first approximation, each deletion creates a “hole” in a uniformly random slot. Insertions then need to “track down” these holes in order to fill them. But each time an insertion probes hi(x)h_i(x) for some element xx and position ii, it has probability at most O(ε)O(\varepsilon) of finding such a hole. Even if the element can somehow check all of h1(x),h2(x),…,hd(x)h_1(x), h_2(x), \ldots, h_d(x) at once (for example, if they are arranged in a bucket), this still indicates a time bound of Ω(ε−1/d)=Ω(ε−1/log⁡ε−1)\Omega(\varepsilon^{-1}/d) = \Omega(\varepsilon^{-1}/\log \varepsilon^{-1}). In general, Bender, Kuszmaul, and Zhou [BKZ24] conjectured that the product of worst-case query time and expected insertion/deletion time must be Ω(ε−1)\Omega(\varepsilon^{-1}) for any open-addressed hash table.

This paper: Optimal worst-case open addressing. We present an open-addressed hash table, called braided cuckoo hashing, that supports worst-case time Θ(log⁡ε−1)\Theta(\log \varepsilon^{-1}) for all of queries, insertions, and deletions, with high probability. This represents an exponential improvement on insertion/deletion time over the bound of Θ~(ε−1)\tilde{\Theta}(\varepsilon^{-1}) that was previously conjectured to be optimal.

Theorem 1.1 (Main Theorem). Let n−1/4≤ε≤1/2n^{-1/4} \leq \varepsilon \leq 1/2. There is an open-addressed hash table using (1+ε)n(1 + \varepsilon)n slots and O(log⁡n)O(\log n) machine words of metadata, that offers the following guarantee for any oblivious polynomial-length insertion/deletion sequence in which the number of live keys never exceeds nn: With high probability in nn, every operation succeeds and every insertion and deletion takes worst-case time O(log⁡ε−1)O(\log \varepsilon^{-1}); additionally, queries take worst-case time O(log⁡ε−1)O(\log \varepsilon^{-1}).

The simplest parameter regime to understand braided cuckoo hashing in is the case where ε=n−Θ(1)\varepsilon = n^{-\Theta(1)}. In this case, each element xx hashes to two bins h1(x)h_1(x) and h2(x)h_2(x) that are each of size Θ(log⁡n)\Theta(\log n). But, unlike in traditional bucketized cuckoo hashing [DW07], these bins are not independent (or even close to independent). Instead, h2h_2 is chosen in such a way that, conditioned on h1(x)h_1(x), there are only O(1)O(1) options for h2(x)h_2(x).

Intuitively, such a strong relationship between h1h_{1} and h2h_{2} would seem to defeat the point of having two hash functions to begin with, potentially making it impossible to place n elements into the hash table. However, by relating all of the bins in the hash table to each other in a specific way (see the braided structure in Figure 2), we are able to preserve the “power-of-two-choice” type phenomenon that makes bucketized cuckoo hashing possible, even though the function h2h_{2} that we use has barely any additional entropy over h1h_{1}. This is the main technical insight that makes the paper possible.

What does the relationship between h1h_{1} and h2h_{2} buy us? It enables deletions to perform what we call pullback chains, which are essentially the opposite of eviction chains: instead of evicting an element from the current bin to another bin, we fill a free slot in the current bin by obtaining an element from some other bin. In normal bucketized cuckoo hashing, pullback chains are not possible, because the elements y that are capable of residing in a given bin h1(x)h_{1}(x) could be almost anywhere in the hash table. But, in braided cuckoo hashing, the elements y capable of residing in a given bin h1(x)h_{1}(x) are themselves in one of only O(1)O(1) bins! This is what makes pullback chains possible.

Using pullback chains, we can maintain the invariant that (if the hash table is almost full) almost all the free slots are in some specific small “layer” of the hash table (the bottom layer in Figure 2). Insertions can then reach these free slots by performing an eviction chain that targets that layer, instead of having to look for them uniformly at random throughout the hash table.

To make this high-level structure work, there are a number of additional technical ingredients that we end up needing. To prove (even in the static setting) that the placement of elements is possible, we must analyze a certain balls-and-bins process (Theorem 5.1). This is where the “braided structure” of the hash table ends up being important, as it allows us to leverage properties of sub-Gaussian random variables to show that the process is well-behaved.

Additionally, to avoid certain types of problematic dependencies, we design our basic data structure

(in the parameter regime ε=n−Θ(1)\varepsilon = n^{-\Theta(1)}) to be history independent, meaning that the current state of the hash table depends only on the current set of elements, and not in any other way on the history of past insertions and deletions. History independence has historically been viewed as a privacy guarantee [NT01], but in recent years has emerged as a useful technical tool for designing dynamic data structures [Kus23, BCFC +^{+}22, BK22, BKSS26, CZ19, BDH +^{+}19, DK26]. Our results can be viewed as a (slightly unexpected) extension of that trend.

Finally, to extend our construction to larger values of ε\varepsilon (not ε=n−Θ(1)\varepsilon = n^{-\Theta(1)}), we must extend the construction so that, when certain failure events occur, elements still have “backup” options for where they can go. This is achieved using a backyard [ANS10], which is a small secondary hash table that absorbs elements with nowhere else to go.

When we put all the pieces together, we are able to prove Theorem 1.1. Additionally, we also prove a lower bound on expected insertion/deletion time. We show, via a simple argument about one-way communication protocols, that any open-addressed hash table with worst-case O(log⁡ε−1)O(\log \varepsilon^{-1})-time queries must incur Ω((log⁡ε−1)/log⁡log⁡ε−1)\Omega((\log \varepsilon^{-1})/\log \log \varepsilon^{-1}) expected-time insertions/deletions. This means that our upper bound on insertion/deletion time is tight up to an O(log⁡log⁡ε−1)O(\log \log \varepsilon^{-1}) factor.

Related work. The concept of an open-addressed hash table, which is a hash table in which queries to an element xx search through a fixed sequence h1(x),h2(x),…∈[m]h_1(x), h_2(x), \ldots \in [m] of positions to find the element being queried, dates back to the early 1950s with the introduction of linear probing [Pet57, Knu63, Knu98] and random-probing [Knu98] hash tables. The first open-addressed hash table to achieve worst-case time bounds was the cuckoo hash table [PR01, Lyo85, HH01], which Pagh and Rodler [PR01] analyzed at any load factor 1/2−Ω(1)1/2 - \Omega(1). This prompted a long line of work [FPSS05, FMM09, FPS13, EGMP14, FJ17, KA19, Wal22, Wal23, BF24, KM25, BK26] on variations of cuckoo hashing, including dd-ary cuckoo hashing [FPSS05] and bucketized cuckoo hashing [DW07] that seek to achieve higher load factors. The main goal of this line of work was to achieve the optimal query time O(log⁡ε−1)O(\log \varepsilon^{-1}) with as small an insertion/deletion time as possible. This culminated in a 2025 result of Kuszmaul and Mitzenmacher [KM25], who showed how to achieve an expected insertion/deletion time of O(ε−1)−aO(\varepsilon^{-1}) - a bound which was conjectured to be optimal up to polylogarithmic factors by Bender, Kuszmaul, and Zhou [BKZ24]. The main result of this paper disproves their conjecture, bringing the insertion/deletion time down to O(log⁡ε−1)O(\log \varepsilon^{-1}).

In addition to d-ary cuckoo hashing (where the d hash functions are independent) and bucketized cuckoo hashing (where each element hashes to independent bins), there have been a number of other variations of cuckoo hashing that researchers have studied. These include deamortized cuckoo hashing [ANS09, KMW10], which uses a queueing/stashing idea to convert insertion time bounds from expected to worst-case (we use this result directly in Section 8); backyard cuckoo hashing and iceberg hashing [ANS10, BCFC +^{+}23], which are succinct hash tables (built on top of open-addressed hash tables) that guarantee each element to be in one of poly( ε−1\varepsilon^{-1}) positions; and filter hashing [FPSS05], which is an insertion-only variant of cuckoo hashing that achieves insertion and query time bounds of O(log⁡2ε−1)O(\log^2 \varepsilon^{-1}). Filter hashing is related to braided cuckoo hashing in that both maintain a layered table in which the free slots are kept in the smallest layer – but the approach in filter hashing works only for insertion workloads (no deletions), since deletions would create free slots in essentially random positions.

Related to cuckoo hashing is the so-called power-of-two choices for load balancing [ABKU94, BCSV00], which says that, if one places m balls into n bins, and each ball chooses the emptier of two random bins, then the fullest bin will have only m/n+O(log⁡log⁡n)m/n + O(\log \log n) balls. Cuckoo hashing is sometimes also described as a “power-of-two-choice” type phenomenon, because it accomplishes something with two hash functions that is impossible to achieve with one.

Open-addressed hash tables (including cuckoo hashing) are typically analyzed under the assumption that the hash functions involved are fully random. There is also a large body of work [Sie89, PP08, Sie04,

Die07, ÖP03, DKRT15, Tho13, BBK +^{+}23] on how to simulate random hash functions efficiently; as well as well-established techniques for applying these hash functions to essentially any hash-table construction (see, e.g., the splitting trick in [DR09]).

Although this paper focuses on worst-case open-addressing, it is also interesting to study hash tables that depart from the open-addressing model, or that are open-addressed but offer non-worst-case guarantees. There have been long lines of work on open addressing with small expected-time operations [Bre73, MC86, FCKK24, FCKK26, BKZ24, ABKS26, Kus26], on non-oblivious open addressing, where queries may follow an adaptive memory pattern [FNSS92, FN93, BKZ25], on succinct and compact dictionaries [RR03, DdHPP06, ANS10, BCFC +^{+}23, BFCK +^{+}22, LLYZ23, LLYZ24, BHK +^{+}26], on stable dictionaries [Yao85, DdHPP06, BCFC +^{+}23, BCFC +^{+}25, PBC +^{+}23, TMKC26, FCKK24, FCKK26, KKW26, Zam26], on dictionaries with extremely high-probability guarantees [GHMT12, BCFC +^{+}23, Kus22], on open addressing in external memory [JP08, BKK22, BK24, KKW26, Zam26], and on variations of open addressing that are widely used in practice [BK70, GS76, LM88, MT12, Mau68, Rad70, HD72, KX24, HKL +^{+}26b, GPW26, Zam26, HKL +^{+}26a].

References (74)