Manuscript Offprint
arXiv:2610.33229Optimal Worst-Case Open Addressing: Braided Cuckoo Hashing
Abstract
In this paper, we introduce braided cuckoo hashing, an open-addressed hash table that supports load factor up to (for some parameter ), while supporting queries, insertions, and deletions in worst-case time , 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 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 is in one of two random slots and in an array of size . To query whether an element is present, one simply checks the slots and . To insert an element , one performs a kickout chain, placing in position , evicting any element in position to its other viable slot , evicting any element in position to its other viable slot , and so on, until the chain terminates at a free slot. Finally, to delete an element , 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 fraction full, each insertion succeeds with probability , and the expected insertion time is .
To support higher load factors, researchers have considered extensions of cuckoo hashing in which each query checks slots in the hash table. These slots can be selected in a variety of ways, for example by using independent hash functions [FPSS05], by breaking slots into buckets and hashing to buckets whose sizes sum to [DW07], or by other more elaborate schemes [FPSS05, ANS09, KMW10, BCFC 23, Wal23]. To support load factor , the optimal value of , and indeed the optimal worst-case query time in any open-addressed hash table, is known to be .
This raises a natural question: If we wish to support worst-case query time , 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 (and in some cases, a function of [FMM09, FPS13]), but conjectured that a bound of the form 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 .
*Carnegie Mellon University (andrew@krapivin.net).
Carnegie Mellon University (kuszmaul@cmu.edu).
There is good reason to believe, intuitively, that a bound of should be optimal. Consider, in particular, a long-running workload that alternates between insertions and deletions at load factor . 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 for some element and position , it has probability at most of finding such a hole. Even if the element can somehow check all of at once (for example, if they are arranged in a bucket), this still indicates a time bound of . In general, Bender, Kuszmaul, and Zhou [BKZ24] conjectured that the product of worst-case query time and expected insertion/deletion time must be 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 for all of queries, insertions, and deletions, with high probability. This represents an exponential improvement on insertion/deletion time over the bound of that was previously conjectured to be optimal.
Theorem 1.1 (Main Theorem). Let . There is an open-addressed hash table using slots and 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 : With high probability in , every operation succeeds and every insertion and deletion takes worst-case time ; additionally, queries take worst-case time .
The simplest parameter regime to understand braided cuckoo hashing in is the case where . In this case, each element hashes to two bins and that are each of size . But, unlike in traditional bucketized cuckoo hashing [DW07], these bins are not independent (or even close to independent). Instead, is chosen in such a way that, conditioned on , there are only options for .
Intuitively, such a strong relationship between and 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 that we use has barely any additional entropy over . This is the main technical insight that makes the paper possible.
What does the relationship between and 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 could be almost anywhere in the hash table. But, in braided cuckoo hashing, the elements y capable of residing in a given bin are themselves in one of only 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 ) 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 (not ), 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 -time queries must incur expected-time insertions/deletions. This means that our upper bound on insertion/deletion time is tight up to an factor.
Related work. The concept of an open-addressed hash table, which is a hash table in which queries to an element search through a fixed sequence 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 . This prompted a long line of work [FPSS05, FMM09, FPS13, EGMP14, FJ17, KA19, Wal22, Wal23, BF24, KM25, BK26] on variations of cuckoo hashing, including -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 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 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 .
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( ) positions; and filter hashing [FPSS05], which is an insertion-only variant of cuckoo hashing that achieves insertion and query time bounds of . 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 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].
Our constructions will offer high-probability guarantees. Formally, we say that an algorithm depending on sufficiently large constants supports a guarantee with high probability in if, for any constant , there exist sufficiently large values for (still constants) such that the guarantee holds with probability at least .
Throughout the paper, we will assume fully random hash functions. One could also straightforwardly implement our constructions with explicit hash functions by, say, combining the -independent hash functions of [Sie04] with the splitting trick in [DR09].
Throughout the paper, we will make use of standard Chernoff bounds. Additionally, several proofs will make use of McDiarmid's inequality , a specialization of Azuma's inequality for martingales with bounded differences. As a reference, we state McDiarmid's inequality here.
Lemma 2.1 (McDiarmid's Inequality). Let be independent random variables from some set , and let be a function that is 1-Lipschitz (changing any input to changes the output by at most 1). Then,
3 Paper Outline
Most of the rest of the paper is devoted to the proof of Theorem 1.1. The high-level structure is as follows.
We begin in Sections 4, 5, and 6, by focusing on a specific parameter regime that ends up being important for the general construction. Specifically, in these sections, we make two simplifying assumptions:
• The High-Load Assumption: The parameter is very close to 0, satisfying . This means that the target time per operation is .
• The Divisibility Assumption: The maximum number of keys n satisfies a certain specific divisibility condition outlined in Subsection 4.1.
With these assumptions in place, we show how to construct a solution that supports -time insertions, deletions, and queries. This construction is itself broken into three sections: Section 4, which describes the array layout and how to determine which bins a given key hashes to; Section 5, which considers the static setting, in which up to keys are given to us in advance; and then Section 6, which extends the construction to support efficient insertions and deletions. Together, these three sections prove Theorem 1.1 for the special case where the assumptions above hold.
Then, in Sections 7, 8, and 9, we extend the construction to prove the full version of Theorem 1.1. We begin, in Section 7, by removing the Divisibility Assumption (this is relatively straightforward). Then, in Section 8, we remove the High-Load Assumption, resulting in a solution that handles arbitrary values of with amortized time insertions/deletions and worst-case time queries. Finally, in Section 9, we show how to deamortize the data structure so that insertions and deletions take worst-case time (with high probability). This completes the proof of Theorem 1.1.
The most technically involved part of the proof is actually the static setting (Section 5), where we need to show that the data structure is even capable of storing keys without irresolvable conflicts. To streamline the presentation, we defer a large part of this proof to Section 11, which appears at the end of the paper.
Finally, in addition to proving Theorem 1.1, we also, in Section 10, prove a lower bound on expected insertion/deletion time: we show, with a simple communication lower-bound based argument, that any open-addressed hash table with worst-case -time queries must incur expected-time insertions/deletions. Whether or not this factor should appear in the lower or upper bound remains open.
4 The Basic Hash-Table Layout
In this section, we describe the basic layout of the hash table, including how to decompose the table into bins, and then how to determine which two bins a given key hashes to.
The construction is parameterized by the maximum number of keys that will ever be present at a time. Given , we will construct a hash table with slots, where in this section (and in Sections 5 and 6), we will support only the specific load factor (we call this the High-Load Assumption). In addition to the parameters and , the construction will make use of a large positive constant , and use “bins” of size . Finally, the construction will make use of two parameters and coming from the Divisibility Assumption defined in Subsection 4.1 – these parameters also serve concrete roles in the construction, with serving as the number of “layers” in the hash table, and serving as the number of bins in the smallest layer. In addition to these parameters, we will also introduce several other families of parameters during the construction that will be useful as notation throughout the analysis: the layers , the number of bins in each layer , and the number of slots in each layer , and the hash functions and , and the probability that selects layer . A table consisting of all the notations is given in Figure 1.
4.1 The Divisibility Assumption
In addition to the High-Load Assumption, we will also make the following divisibility assumption on our parameters. Given the parameter n (the maximum number of keys) and the parameter B (the bin
| Parameter | Meaning | Formula (If Applicable) |
|---|---|---|
| Maximum number of keys at a time | ||
| Total number of slots in the hash table | ||
| Load factor parameter | ||
| Large positive constant used to set the bin size | ||
| Number of slots in each bin | ||
| Integer parameter from the Divisibility Assumption; | ||
| is the number of bins in the final layer | ||
| Number of layers in the hash table | ||
| Layer of the hash table, for | ||
| Number of bins in layer | ||
| Number of slots in layer | ||
| First and second hash functions mapping a key to a bin | ||
| Probability that selects layer | $n \sum_{j |
Figure 1: Summary of notation for the basic hash-table layout.
size, given by , we will assume there exist integers and satisfying
with
Equivalently,
This assumption, which we call the Divisibility Assumption, is used to make the layer sizes in our construction exact powers of two. The assumption will later be removed in Section 7.
4.2 Braided Cuckoo Hashing
With both the High-Load Assumption and the Divisibility Assumption in mind, we now present the basic layout of a braided cuckoo hash table.
Layers and bins. The hash table is organized into layers , where each layer has a power-of-two number of bins that each contain exactly slots. For , define
to be the number of bins in layer , and define to be the number of slots in layer . Thus .
As we check below, the total number of slots in the table is , and thus .
Lemma 4.1. The total number of slots in the table satisfies .
Proof. The total number of slots before the final layer is
The final layer has slots. Hence
By the assumptions on , the final layer has , meaning that
as desired.
One should think of the final layer serving as a slack layer. When there are n elements in the hash table, they will (with high probability) be organized in a way so that all the previous layers are 100% full, while the final layer is only 50% full.
The first hash function. Within the hash table, each element x hashes to two bins and .
The hash function first selects a layer, where each layer is selected with some probability to be defined in a moment, and then selects a uniformly random bin within that layer.
The final layer is never selected by , so . For every , the probabilities are chosen so that
Equivalently,
In words, before layer , the expected number of elements whose first hash lies in earlier layers is equal to the number of slots in those earlier layers, plus half the number of slots in layer .
The equation for gives
as in the proof of the lemma above, and hence . Thus form a probability distribution over the non-final layers (while ).
The second hash function. We now define . Suppose that selects a bin in layer , where . Since
we may identify the bins of with binary strings of length
Write the bin selected by as
The second hash is placed in layer . Since , the bins of may be identified with binary strings of length .
To obtain the bin in selected by , first delete the final bit , leaving . Next, consider the pair of bits in positions and , and replace the pair
by one of the other three possible two-bit strings, chosen uniformly at random. All other bits are left unchanged. The resulting string has length , and therefore identifies a bin in layer . This bin is .
Equivalently, conditioned on
the hash is uniformly distributed over the three bins in layer whose addresses agree with in every position except possibly positions and , and whose two-bit string in those positions differs from the original pair .
Of course, in order to ensure is well-defined, we need to make sure that the bit positions and exist (i.e., that ). This is verified in the following lemma.
Lemma 4.2. The second hash function is well-defined.
Proof. Suppose selects a bin in layer , where . The address of this bin has length . After deleting the final bit, the remaining string has length . Thus the bit positions and exist provided
The hardest case is . In that case, . So it suffices to show
By assumption, and . Therefore, for all sufficiently large ,
Hence for every , and is well-defined.
The full picture: braided cuckoo hashing. Having described the bin layout and the two hash functions, we can now take a moment to consider what a braided cuckoo hash table actually looks like. Figure 2 shows a four-layer instance of the hash-table construction. Each dot represents a bin, and an edge from a bin in to a bin in indicates that the pair is a legal outcome for the hashes of an element .
Notice that the edges between layers interleave in a way that looks almost like braids – this is where the name “braided cuckoo hashing” comes from.
It is worth remarking on how sparse the graph in Figure 2 is. Whereas, in traditional cuckoo-hashing constructions, each element chooses out of possible edges, braided cuckoo hashing has only such pairs. In fact, each node in Figure 2 is incident to at most 9 other nodes (6 from the previous layer, and 3 from the next layer).
The fact that nodes have degree will end up being critical for supporting insertions and deletions efficiently in Section 6. At the same time, the sparseness of the graph makes it highly non-obvious whether it is even possible to place n elements together in the hash table. This will be the focus of the next section, and is where the specific “braided structure” of the table ends up being important.

Figure 2: A four-layer instance of the hash-table construction with layers containing , , , and bins. To represent a bin number as a binary string, we use the first bit as the most significant bit, and the last bit as the least significant bit.
5 Static Placement
In this section we consider the static problem of placing n elements into the braided cuckoo hash table. We will show that, despite the somewhat odd structure of the hash table, there is a simple way of placing the elements into the hash table that succeeds with high probability. As in the previous section, we will make both the High-Load Assumption and the Divisibility Assumption throughout.
The static placement process. We now describe a simple placement process for a fixed set of n elements. The process places elements layer by layer, using as the primary choice and only when the primary bin is already full.
For an element x, let
denote the layer containing . Recall that never selects the final layer . If , then is a bin in the next layer .
Consider a static placement process that proceeds in phases as follows. During phase , for each bin , we consider the elements with . The bin may already contain elements forwarded from ; we place as many of the elements with into the remaining slots of as possible, and forward the rest to their second-choice bins .
The choice of which elements are forwarded, out of those with , is made without looking at their hashes. So, conditioned on being forwarded, each element's second hash is still independently and uniformly distributed over the three allowed choices.
The Static Placement Theorem. The main result of this section is the following theorem, which shows that the static placement process succeeds with high probability.
Theorem 5.1 (Static placement theorem). Suppose the constant c used in the construction is sufficiently large. Then with high probability in n, the following events hold simultaneously.
- For every layer with , and every bin , the number of elements forwarded into from layer satisfies
Notably, this means that no element is ever forwarded to a bin that is already full.
- After all n elements have been placed, the only remaining free slots are in the final layer .
We will also need an extension of the Static Placement Theorem to the underloaded regime, where the table (built for capacity parameter ) is used to store keys. For a bin with , let denote the set of predecessor bins from which elements may be forwarded to ; the structure of will force . For , let denote the number of elements forwarded from to . The following theorem contains not just variations of the conclusions of the Static Placement Theorem, but also one more point that will be important: that every bin in layers , , with probability at least , either has a free slot, or has elements forwarded to it from each of its predecessors .
Theorem 5.2 (Static placement with fewer than n keys). Suppose the constant c used in the construction is sufficiently large. Fix any , and run the static placement process on keys in the table constructed for parameter n. There is an absolute constant such that, with high probability in n, the following events hold simultaneously.
-
Every forwarded element is successfully placed in its second-choice bin, and for bins in layers , , the number of elements forwarded into from layer satisfies .
-
Every bin in the final layer has at least one free slot.
-
For every layer with , and every bin , either has a free slot after the placement process completes, or
Technical overview. For brevity, we defer the proof of the Static Placement Theorem to Section 11, and the proof of the static placement with fewer than n keys theorem to Section 11.3. Here, instead, we give a high-level technical overview (focusing only on Theorem 5.1).
The main challenge is showing that no bin ever has more balls forwarded to it than it can hold (or so few balls forwarded to it that it is unexpectedly underloaded). For each bin q, let its overflow mean the number of balls that q forwards to the next layer (balls with but that did not fit in q). The main risk that we run is a potential positive-feedback loop, in which, as we look at bins in later and later layers, the variance of each bin's overflow increases. This would eventually lead to some bins having an overflow that is either uncontrollably large (too large for the next-layer bins to handle) or too small (resulting in bins in the next layer being underloaded).
Thus the core of the proof is to show that the per-bin overflow variance is actually subject to a negative feedback loop: variance inherited from the previous layer is damped before it reaches the next layer, and the new variance introduced from the current layer is only . Once this variance control is established, it is not hard to strengthen the analysis to argue that, within each bin, the overflow is a sub-Gaussian random variable – this implies that the overflow is tightly concentrated around its intended mean of , which allows us to complete the proof.
The proof proceeds by induction, where the inductive step considers (roughly) the following scenario. Suppose, heuristically, that every bin in layer overflows by roughly elements, with variance at most for some large constant ; further suppose that these overflows are mutually independent (they are not, but we will come back to this later). Then, to perform the inductive step, we must consider some bin and argue that 's overflow also has expectation roughly and variance at most . Since the calculation of the expectation is straightforward, we will focus here exclusively on the variance.
The definition of is designed so that q has exactly six possible predecessor bins in . From each predecessor bin, an overflowed element chooses among three possible destinations in , one of which is q. Thus q receives, from each predecessor, roughly one third of that predecessor's overflow.
Consider one predecessor bin, and let X be its overflow, with mean roughly B/4 and variance at most CB. The number of these X overflowed elements that are sent to the fixed bin q is obtained by independently keeping each of them with probability 1/3.
This sampling affects the variance in two ways. First, the fluctuation already present in X is scaled down by a factor of 3, so its variance contribution is scaled down by 9. Second, the random sampling itself introduces fresh variance. Since X is typically , this fresh variance is only . Thus a single predecessor contributes variance roughly
to the load of q. Since q has six predecessors, the forwarded load into q has variance roughly
In addition to the elements forwarded from the previous layer, also receives elements that hash to it via . The number of such elements has variance . Therefore, the overflow of , which is given by roughly
(incoming forwarded load) + arrivals
has variance at most
By choosing C sufficiently large, this is at most, say,
Thus, critically, there is slack: going from one layer to the next, the variance is still bounded by CB. This is the heart of the induction.
Finally, it is worth discussing why we can make the independence assumption used in this calculation (i.e., that overflows from the bins in the previous layer are mutually independent), as this is the main place where the specific “braided structure” of the table comes into play. Of course, overflows from arbitrary bins in the same layer are not independent: nearby bins may have interacted through earlier forwarding steps. The point of the construction of is that the six predecessor bins of a fixed bin are not arbitrary nearby bins. They differ only in the bit-pair that is used for the transition from to , together with the bit that is deleted in that transition. Transitions in earlier layers never toggled these bits. So, if we build for each predecessor bin a predecessor tree consisting of 's predecessors in , their predecessors in , and so on, then we will find that the trees are disjoint across the six predecessor bins . Consequently, for the purposes of analyzing the load forwarded into , the six predecessor overflows may be treated as independent . The obliviousness of the forwarding rule is also important here: conditioned on an element being forwarded, its choice among the three possible destinations in the next layer remains uniform and independent of the event that it was forwarded.
When we put the pieces together, we can prove within each layer that the overflow in each bin behaves roughly like a Gaussian random variable with mean B/4 and variance at most CB. Because B itself is a large constant multiple of (thanks to the High-Load Assumption), the probability of a given bin behaving poorly (overflowing by too much or too little) is . This is sufficiently small that we can union bound over all bins in order to prove the theorem.
Technically, they are still not independent due to the fact that the numbers of balls which hash to different parts of the table are not quite independent, but this point can easily be handled in the analysis using a Poissonization argument.
6 Dynamic Placement
We now consider the dynamic setting: The goal is to support an arbitrary oblivious sequence of
insertions and deletions, subject to the constraint that at most n keys are present at any time. We want every operation to succeed with high probability in n in time . Note that, as in the previous sections, we continue to make both the High-Load Assumption and the Divisibility Assumption.
An interesting aspect of the algorithms in this section is the subtle role of history independence [NT01]. A data structure is strongly history independent if, at any given moment, the state of the data structure is completely determined by the current set of keys, together with the fixed randomness of any hash functions that the data structure uses. It is weakly history independent if the probability distribution of the state of the data structure is completely determined by the current set of keys, again together with the fixed randomness of the hash functions. History independence is often studied as a security property [NT01]: if the memory representation of the data structure is leaked to an adversary, it does not reveal any unintended information about the sequence of operations that produced the current set of keys.
In our setting, however, history independence plays a different role. It gives a way to keep the table in a continually well-controlled state, one that can still be analyzed using the Static Placement Theorem. More concretely, it prevents reappearance dependencies: problematic dependencies that can arise when an element is inserted, deleted, and later reinserted, at which point its hash values have already influenced the previous state of the table. In our context, we must be sensitive to avoid any reappearance dependencies that might, for example, cause a bin to evict elements in a way that is biased towards evicting those with a specific second hash . This type of bias could cause the bin to become severely overloaded, breaking the guarantees of the Static Placement Theorem. We will see that history independence lets us dodge this issue, and more generally the issue of reappearance dependencies, entirely. To make this connection explicit, we will state in our theorems not only the running times of the dynamic constructions below, but also their history-independence guarantees.
The rest of the section is split into two parts. First, we present a simple warmup construction that achieves -time operations. The advantage of the warmup is that it is conceptually simple: a priority hash function canonically determines which keys overflow from each bin, guaranteeing that the resulting table is strongly history independent. The drawback is that each step of an eviction chain or pullback chain costs time, giving -time operations. To eliminate this drawback, our second construction shows how to build a slightly more subtle weakly history-independent solution that, with the help of reservoir-sampling style techniques, is able to support -time operations with high probability.
We remark that, in addition to being pedagogically useful, the strongly history-independent warmup construction ends up being concretely useful later in the paper, allowing us to avoid potentially painful dependencies when rebuilding parts of the data structure in Section 9.
Conventions for discussing eviction chains. In both of our algorithms, insertions will perform what we call a forward eviction chain. A key first tries to enter its first-choice bin. If that bin is full, the algorithm evicts one resident first-choice key from the bin (possibly the key currently being inserted) and forwards the evicted key to its second-choice bin. This may cause another eviction in the next layer, and so on.
For example, a data structure that stores up to n keys in a prefix of an array of size n would be strongly history independent if it stored the keys in some canonical sorted order, and would be weakly history independent if it stored the keys in a uniformly random order, supporting insertions and deletions by the usual random-prefix insertion and deletion operations.
Deletions, on the other hand, will perform what we call a pullback chain. Removing a key leaves a hole in some bin q. If q has a key that had overflowed out of q, then one such key is pulled back into q. This creates a hole in the pulled-back key's second-choice bin, and the process continues.
Note that both types of chains are guaranteed to have length at most .
Additional notation. Finally, before we continue, it will also be helpful to introduce some notation that we will use throughout the rest of the section. Let S be the current set of keys in the hash table. For a bin q, let
be the keys whose first-choice bin is . Let be the keys forwarded into from the previous layer. For , define
The bin must overflow exactly keys from . We write
for this overflowing set. The bin q stores
and each key in is stored in its second-choice bin. Bins in the final layer have no first-choice keys, since never selects .
Finally, for a bin q, we will let denote the three possible second-choice bins of keys whose first-choice bin is q.
We remark that the sets are used only in the analysis. The data structure stores no metadata. Given a key in a slot, we can recompute its - and -values to determine whether it is stored in its first-choice or second-choice bin.
6.1 An -time Strongly History-Independent Warmup
The first construction uses a priority hash function
to determine which keys get forwarded from a given bin to its successors in the next layer. For a given bin , we maintain the invariant that the elements that forwards to the next layer are precisely the elements of with the smallest -values. This invariant completely determines which keys go to which bins. Then, within a bin, we store the keys in an arbitrary canonical order (say, lexicographically). The result is a strongly history-independent data structure: the state, at any given moment, is completely determined by the current set of elements and the functions .
Implementing insertions and deletions. Having described the invariant that determines the state of the data structure, we now discuss how to implement insertions and deletions in order to preserve the invariant.
The following helper procedures all touch only a constant number of bins, and therefore cost time.
FIND(x) return such that x is stored in q; CANONICALINSERT(q, x) insert x into q and restore the canonical order; CANONICALDELETE(q, x) delete x from q and restore the canonical order; RESIDENTPRIMARIES(q) return ; OVERFLOWEDFROM(q) return .
Using these helper functions as subroutines, insertions and deletions can be implemented as follows. The two victim-selection procedures encode the priority rule: an insertion evicts the lowest-priority eligible first-choice key, while a deletion pulls back the highest-priority key that had previously overflowed. The insertion and deletion algorithms then simply apply these procedures along the forward eviction chain or the pullback chain, respectively.
Algorithm 1 SHI-EVICTIONVICTIM(q, y)
Require: A full bin q, and an incoming key y trying to enter q.
1: if then
2: .
3: else
4: .
5: if then
6: The table has failed.
7: return the key minimizing .
Algorithm 2 SHI-PULLBACKVICTIM(q)
1: .
2: if then
3: return .
4: else
5: return the key maximizing .
Algorithm 3 SHI-INSERT(x)
1: .
2: .
3: while true do
4: if q has a free slot then
5: CANONICALINSERT(q, y).
6: return
7: .
8: if then
9: CANONICALDELETE(q, z).
10: CANONICALINSERT(q, y).
11: .
12: .
Algorithm 4 SHI-DELETE(x)
1: . 2: CANONICALDELETE( ). 3: while do 4: . 5: if then 6: return 7: . 8: CANONICALDELETE( ). 9: CANONICALINSERT( ). 10: .
Analysis. Having described the insertion and deletion algorithms, we can now analyze the algorithm. Critically, thanks to history independence, the state of the data structure at any given moment can be reasoned about through the Static Placement Theorem.
Theorem 6.1 (Strongly History-Independent Dynamic Placement). Suppose that the parameters , , satisfy the Divisibility Assumption from Subsection 4.1. Consider an oblivious sequence of insertions and deletions that never has more than live keys at a time; and assume that the constant used by the algorithm is sufficiently large as a function of .
Then the algorithm above uses slots, is strongly history-independent, and supports the full insertion/deletion sequence without failure with high probability in . Each insertion or deletion takes time , while queries take time .
Proof. It is straightforward to verify that the insertion and deletion procedures above correctly maintain the invariant that, if the current set of elements is , then the overflowing set of each bin consists of the elements of with the smallest -values; and that the only bins to have free slots are the bins with no overflow elements, meaning . It follows that the state of the hash table, at any given moment, is precisely what one obtains by applying the static placement process from Section 5, with the rule that, when selecting elements from to overflow out of bin , we select those with the smallest -values.
This implies two things: (1) that the data structure is strongly history independent, as claimed, and (2) that we can apply the Static Placement Theorem with keys (Theorem 5.2) to reason about the state of the hash table at any given moment. From Theorem 5.2, we know that, with high probability in , every bin has at most elements forwarded to it from each of its predecessors, so any bin which is full has at least one element with . Taking a union bound over the updates, we know that, with high probability in , this is true before every insertion. Thus, critically, the failure condition in SHI-EVICTIONVICTIM can never be triggered – every bin that we wish to find an insertion-eviction victim in will have at least one valid victim, namely some element with . Since this is the only way in which the hash table can incur a failure, the probability of failure is at most .
Finally, should no failure occur, the worst-case time bounds are determined as follows. Each insertion or deletion interacts with at most bins, and spends time interacting with each one. Therefore, the worst-case time per insertion or deletion is . Queries, on the other hand, take worst-case time , since they need only check two bins.
6.2 An -time Solution via Weak History Independence
The reason that the algorithm in the previous section is unable to achieve -time operations is that, each time it is selecting a key to evict or pull back, it must find the specific key that the strongly history-independent algorithm requires it to move. This forces the algorithm to either spend time scanning the bin to find the key (if the bin is unsorted) or time keeping the bin in sorted order each time the bin is modified (if the bin is sorted, as in the implementation given in the previous section). Either way, the algorithm spends time at every step of the eviction or pullback chain.
In this section, we will see that by using a weakly history-independent data structure, as opposed to a strongly history-independent one, we can reduce the time per operation to . The basic idea is that, instead of finding a specific key to move (during an eviction or pullback), it suffices to instead make sure that the key which we move is chosen from a certain probability distribution; and, if we do this correctly, we can still maintain (weak) history independence, but with time (on average) per eviction or pullback step.
Formally, the weakly history-independent data structure maintains the following distributional invariant:
The Uniform Overflow Invariant: For every bin , conditioned on the placements in earlier layers and on the value , the overflowing set is a uniformly random -subset of (and this is independent across bins in the same layer).
Note that, if we have this invariant, then we can still apply the Static Placement Theorem, because the state of the data structure at any given moment is precisely what one obtains by applying the static placement process from Section 5, with the rule that, when selecting elements from to overflow out of bin , we select a uniformly random subset.
In addition to maintaining the Uniform Overflow Invariant, we will also maintain a second invariant that, within each bin, the keys are kept in a uniformly random order (independently across bins); and if the bin has free slots, then those slots all appear at the end of the bin.
The insertion and deletion algorithms. At a high level, the algorithm works as follows. Whenever an insertion needs to evict a key forward, or a deletion needs to pull a key backward, we use a sampling procedure to choose the key that moves. The sampling procedures are designed so that the chosen key has exactly the distribution needed to preserve the Uniform Overflow Invariant.
The procedures for finding a key to evict or pull back will now use rejection sampling to find the desired key. Using the properties from the (underloaded) Static Placement Theorem (Theorem 5.2), we will be able to argue that each sampling trial has probability of success. This gives an expected-time bound of per eviction/pullback, and applying a Chernoff bound over all the eviction/pullback steps we will be able to recover a high-probability time bound of .
We now give the procedures used to implement insertions and deletions. First, the following two routines maintain the random occupied-prefix representation of each bin.
We remark that this second invariant is not necessary for the correctness or time bounds of the algorithm, but it is technically necessary in order for us to declare that the resulting data structure is weakly history-independent. It is also slightly convenient algorithmically, as it lets us test in time whether a bin is full, by checking only its final slot.
Algorithm 5 RANDOMPREFIXINSERT(q, x, k)
Require: Bin q currently contains keys in a random occupied prefix.
1: Choose uniformly at random.
2: if then
3: Move the key in slot j to slot .
4: Store x in slot j.
Algorithm 6 RANDOMPREFIXDELETE(q, s, k)
Require: Bin q currently contains k keys in a random occupied prefix, and slot is to be deleted.
1: if then
2: Move the key in slot k to slot s.
3: Clear slot k.
We also use the following basic helpers.
FULL(q) return whether bin q is full, by checking whether slot B is occupied;
LOAD(q) return the number of elements in bin q, through a linear scan of the slots;
FIND(x) return the pair such that x is in slot s of bin q.
Next come the sampling procedures used to find keys for evictions and pullbacks. The first procedure samples a uniformly random resident first-choice key of a full bin. This is the operation needed at an internal step of a forward eviction chain. The second handles the first step of an insertion, where the new key itself must also be included in the sample. The third samples a uniformly random key that has overflowed out of a bin q; this is the operation needed in a pullback chain.
Algorithm 7 SAMPLERESIDENTPRIMARY(q)
Require: A full bin q.
1: for do
2: Choose a uniformly random slot of q.
3: if slot s contains a key z with then
4: return .
5: Scan slots of q for a key z with .
6: if no such key exists then
7: The table has failed.
8: return .
Algorithm 8 SAMPLEPRIMARYORNEW(q, y)
Require: A full bin q, and a new key y with .
1: repeat
2: Choose uniformly from the following locations:
the B slots of q, the 3B slots in the bins of , and the singleton location .
3: until the chosen location is , or contains a key z with
4: return the selected key and its location.
▷ If was chosen, this is .
Algorithm 9 SAMPLEOVERFLOW(q)
Require: A bin q that has just lost a key. 1: if every bin in Succ(q) is nonfull then 2: Scan the bins in Succ(q), collecting all keys z with . 3: if no such key exists then 4: return ⊥. 5: else 6: return a uniformly random collected key, together with its slot. 7: else 8: repeat 9: Choose a uniformly random slot s among the 3B slots in the bins of Succ(q). 10: until slot s contains a key z with 11: return (z, s).
The insertion algorithm follows a forward eviction chain. At the first step, the incoming key is a new first-choice key, so we sample from . At all later steps, the incoming key was forwarded from the previous layer, so we sample only from the resident first-choice keys of the current bin.
Algorithm 10 WHI-INSERT(x)
1: . 2: . 3: while true do 4: if then 5: . 6: RANDOMPREFIXINSERT(q, y, k). 7: return 8: if then 9: . 10: if loc is a slot of q then 11: Replace z by y in that slot. 12: . 13: else 14: . 15: else 16: . 17: Replace z by y in slot s. 18: . 19: .
Deletion creates a pullback chain. If the bin from which the key is deleted was already nonfull, then it had no overflowed keys of its own and the operation stops after the deletion. Otherwise, the bin has just acquired a hole, and we try to fill that hole by pulling back a uniformly random key that had overflowed out of it.
Algorithm 11 WHI-DELETE(x)
1: . 2: if FULL(q) then 3: RANDOMPREFIXDELETE(q, s, B). 4: while do 5: . 6: if then 7: return 8: Let be the entries of , and let . 9: RANDOMPREFIXINSERT(q, z, B - 1). 10: if FULL( ) then 11: RANDOMPREFIXDELETE( , s, B). 12: . 13: else 14: RANDOMPREFIXDELETE( , s, LOAD( )). 15: return 16: else 17: RANDOMPREFIXDELETE(q, s, LOAD(q)). 18: return
Analysis. Having described the insertion and deletion algorithms, we can now analyze the algorithm. We first argue that the sampling procedures correctly preserve the Uniform Overflow Invariant.
Lemma 6.1. At any given moment, if the hash table has not failed, then the Uniform Overflow Invariant holds: for every bin , conditional on the placements in earlier layers, the overflowing set is a uniformly random -subset of the set consisting of elements with first-hash (and this is independent across bins in the same layer).
Proof. It suffices to prove that insertions and deletions preserve the invariant. Moreover, since the algorithm only lets a bin have free slots if the bin has no overflowed keys (no keys with are in the next layer), the number of overflowed keys from each bin will always be . So the only thing that we need to check is that the keys in are a uniformly random subset of those in . Throughout the rest of the proof, to avoid ambiguity, we will use , , and to refer to the values that these quantities had before the current operation.
Consider the first step of an insertion, where a new key enters its first-choice bin . Suppose is full. After inserting , the overflowing set should be a uniformly random -subset of . The procedure SAMPLEPRIMARYORNEW samples a uniform key
If , the new key becomes the newly overflowed key. If , then becomes the newly overflowed key. This correctly places into the overflow set with probability , and the rest of the time it moves a uniformly random element in to ; so, overall, the invariant that is uniformly random from is preserved.
At every later step of the eviction chain, the incoming key is forwarded from the previous layer. Thus itself has not changed, but increases by one. Starting from a uniform -subset , the correct update is to add a uniformly random key from . These are exactly the resident first-choice keys of q, and SAMPLERESIDENTPRIMARY(q) samples one uniformly. Therefore, each subsequent step of the eviction chain preserves the invariant.
Now consider deletion. If a deletion removes a key with , then the removal of (before we begin any pullback chain) preserves the invariant that the overflowed elements from are a uniformly random subset of the elements present with (now ).
Next, we verify that the pullback chain preserves the invariant. For pullback to occur, the bin from which is removed must have overflowed keys, meaning that decreases by one, and the correct update is to remove a uniformly random key from , and to bring that element back to the bin . The procedure SAMPLEOVERFLOW() does exactly this, so the invariant is once again preserved.
We also observe that, within each bin, the placement of keys is uniformly random within some prefix of the bin. As discussed earlier, this invariant is not necessary for the correctness or running time guarantees, but it is necessary to declare the algorithm weakly history-independent.
Lemma 6.2. At any given moment, if a bin q contains j elements, then they are placed in a uniformly random order in the first j slots of a bin (and this is independent across bins).
Proof. By design, any call to RANDOMPREFIXINSERT or RANDOMPREFIXDELETE preserves the invariant. More subtly, when either an eviction chain or a pullback chain replaces a sampled victim z by an incoming key y in a full bin, the choice of who z is is independent of the order of keys within the bin. Conditioned on the identity of z, the slot of z is uniformly random. Given a uniformly random permutation of j elements Q, if we overwrite a fixed one of those elements z with a new element y, the resulting permutation is still uniformly random over the elements in . Thus, again, the invariant is preserved.
Theorem 6.2 (Weakly History-Independent Dynamic Placement). Suppose that the parameters , , satisfy the Divisibility Assumption from Subsection 4.1. Consider an oblivious sequence of insertions and deletions that never has more than live keys at a time; and assume that the constant used by the algorithm is sufficiently large as a function of .
Then the algorithm above uses slots, is weakly history-independent, and supports the full insertion/deletion sequence without failure with high probability in . Each insertion or deletion takes time with high probability in , while queries take time in the worst case.
Proof. The preceding lemmas tell us that the algorithm is weakly history-independent. And, more importantly, that the state of the hash table at any given moment is drawn from the same distribution as if we were to rebuild the hash table from scratch with the same set of keys, using the static placement process, and with the rule that each overflowing bin forwards a uniformly random subset of its keys to the next layer. Thus, we can apply the (underloaded) Static Placement Theorem (Theorem 5.2) to conclude that, at any given moment, with high probability in n, the following events hold:
-
Every bin q has at most 3B/4 keys forwarded into it from the previous layer.
-
Every bin in a layer , , either has a free slot or satisfies for each of its predecessors . (Recall that is the number of keys forwarded from to .)
Since we are interested only in a polynomial number T of insertions/deletions, we have with high probability in n that these hold before and after every operation.
To complete the proof, we argue that, if the above events hold before a given insertion or deletion, then the operation succeeds (with probability 1) and takes time with high probability in n.
First, note that the only way for the operation to fail is if the failure condition is triggered in SAMPLERESIDENTPRIMARY. This can only happen if some bin becomes completely occupied by elements forwarded from the previous layer. But, this means that, before the operation, we had , which is a contradiction.
Finally, we argue that the operation takes time with high probability in n. To do this, we must reason about the time taken by each of the sampling procedures. Specifically, for a given sampling procedure, what is the probability that each of its sampling trials succeeds (conditioned on everything else that has happened so far)?
First, consider SAMPLERESIDENTPRIMARY(q). This procedure is used only when q is full (and has not been edited yet by the current operation). Since at most 3B/4 of the keys in q were forwarded from the previous layer, at least B/4 slots contain resident first-choice keys of q. Therefore each trial succeeds with probability at least 1/4.
The same observation handles SAMPLEPRIMARYORNEW(q, y). The sample space has size : the bin q, the three successor bins of q, and the singleton location . Since q is full and contains at least B/4 resident first-choice keys of q, each trial succeeds with probability .
The only subtle sampler is SAMPLEOVERFLOW(q). Suppose first that every successor of q is nonfull. Then the procedure scans the three successor bins. This costs , but it is necessarily the final step of the pullback chain. Indeed, after a key is pulled out of a nonfull successor , that successor still has a free slot, so the pullback chain stops.
Now suppose that at least one successor is full. Since is a predecessor of ,
Thus at least of the 3B slots in the successor bins contain keys overflowed from . Each rejection-sampling trial in SAMPLEOVERFLOW( ) therefore succeeds with probability at least .
Consequently, apart from the final step in a pullback chain, every trial made by every sampler has conditional success probability . An eviction or pullback chain has length at most , so an operation needs at most successful samples. A Chernoff bound tells us that, for any , if we flip coins that each independently have probability of heads, then the number of flips needed to get heads is at most with high probability in . Thus the total time spent in sampling procedures (outside of the final call to SAMPLEOVERFLOW) is at most .
The remaining costs are per operation, as they are all incurred in either the first or final step of the chain, and from procedures that take time at most in the worst case. The theorem therefore follows.
7 Removing the Divisibility Assumption
So far, all of our results have been stated under the Divisibility Assumption from Subsection 4.1. This assumption states that the number n can be expressed as
where and are integers satisfying and . The assumption allowed us to design each layer of the hash table to have an exactly power-of-two number of bins.
In this section, we argue that the Divisibility Assumption is essentially WLOG, so long as we are willing to consider load factors of at most, say, . The basic idea is that, given any capacity , we can break the table into equal- and polynomial-size sub-tables (“blocks”) for which the arithmetic assumptions hold, and we can hash each key to a block. We can then apply a Chernoff to show that each block, with high probability, receives very close to the number of keys it is supposed to. And, finally, we can treat each of the blocks as a separate hash table satisfying the Divisibility Assumption.
The following theorem, whose proof is deferred to Appendix A, makes this reduction explicit, and removes the Divisibility Assumption from the results in the previous section.
Theorem 7.1 (Arbitrary capacities). There is a constant , in fact one may take , such that: For every sufficiently large , there exists a hash table construction with the same guarantees as Theorem 6.2 (or, if one wishes, Theorem 6.1), but using slots.
8 Supporting Arbitrary Load Factors
So far, the data structures in the paper have been tuned to operate at load factor , while supporting insertions, deletions, and queries in time . In this section we explain how to support load factor , for an arbitrary parameter (where is some absolute constant determined by the theorem below), with time-per-operation rather than .
Theorem 8.1 (Load factor ). There are absolute constants and such that, for every , there is an open-addressed hash table using slots, and that can support any oblivious insertion/deletion sequence of length , with up to live keys at a time, with the following guarantees. With probability at least , every operation succeeds. Queries take worst-case time , and insertions and deletions take expected amortized time .
The only source of amortization is a global rebuild performed once every n updates, which is also permitted to use up to n additional slots of temporary space. In addition to the slots themselves, the hash table stores machine words of metadata.
The amortization (and the large amount of temporary space used during rebuilds) will both be removed in Section 9.
The constants used in the proof are not optimized. Throughout the section we will assume that and are sufficiently small positive constants.
Why a direct retuning is not enough. To prove the theorem, a tempting approach would be to directly modify the construction from the previous section to use bins of size instead of . This would give the desired time and space bound if the construction succeeded, but the resulting table would fail with substantial probability, even for static placement.
Indeed, consider a compatible pair of bins that can arise as the first and second choices of a key. The probability that a fixed key has this particular pair of choices is , so the number of keys with this pair of choices has mean . If , then the probability that this pair receives more keys than the 2B slots available in is (rather than ). Since there are possible pairs , we expect roughly poly( ) such pairs to be overloaded, which is much larger than 1 for natural values of .
Thus, we cannot hope to prove Theorem 8.1 by simply reusing the construction from the previous section.
This section: Using a frontyard/backyard structure to prove Theorem 8.1. Instead, we take a slightly more elaborate approach which, at a high level, is as follows.
We break the data structure into a “frontyard” and a “backyard” [ANS10, BCFC 23]. The frontyard, which consists of the vast majority of the slots in the table, is divided into independent mini-structures of size , each of which is implemented using the construction from Theorem 7.1 (applied to
Theorem 6.2). Each key hashes to a random mini-structure, and by default insertions/deletions are performed on that mini-structure. If, however, an operation takes too long (time at least L, where L is a sufficiently large constant multiplied by ) or incurs a failure, then the operation is aborted in the mini-structure and completes in the backyard. The backyard can therefore be viewed as a “fallback” data structure to handle failures (either time failures or genuine failures) that occur in the frontyard.
Additionally, once every n updates, we rebuild the entire structure from scratch, allowing us to clear out unnecessary elements from the backyard, and to “repair” mini-structures that have incurred failures (but that are ready to be used again).
We will describe the role of the frontyard and the backyard in more detail below. The key insight in the analysis will be to show that (with high probability in ) the number of slots that we need for the backyard is very small ( poly()), so the overall space usage remains at most slots.
8.1 Data Structure Description
We now present the full description of the data structure.
The frontyard. Let , where for convenience we assume N is an integer (rounding does not affect the argument that follows at all).
Each frontyard mini-structure is an independent copy of the data structure from Theorem 7.1 (applied to Theorem 6.2), with capacity parameter . Thus one mini-structure uses slots, supports -time queries, and supports any poly( )-length sequence of insertions and deletions with at most live keys in time per operation, with high probability in .
We use
frontyard mini-structures. A fixed top-level hash function assigns each key to one mini-structure.
The total number of frontyard slots is
where the final step uses that and that , both of which follow from the facts that and for some sufficiently small .
The backyard. The remaining slots are allocated to a backyard of size
The backyard is implemented using the deamortized cuckoo hashing construction of Arbitman, Naor, and Segev [ANS09]. We use the following black-box form of their result.
Lemma 8.1 (Deamortized Cuckoo Hashing [ANS09]). Fix constants and . There is an open-addressed hash table using slots and machine words of metadata that offers the following guarantee. For any oblivious sequence of at most insertions, deletions, and queries, if the number of live keys is always at most , then, with probability at least , every operation succeeds and every operation takes worst-case time.
Queries, insertions, and deletions. We now describe how the frontyard and backyard are used to implement the operations.
Queries can simply query the backyard (in time ) and one frontyard mini-structure (in time ). Insertions and deletions, on the other hand, follow a slightly more intricate protocol. The basic idea is to set a parameter
where is a sufficiently large constant, and then to use the following rule: By default, we perform operations in the appropriate frontyard mini-structure, but whenever an operation takes time more than L, we truncate it early, and if necessary, we move elements to the backyard to preserve correctness.
More concretely, we insert a key x as follows. We begin the insertion in mini-structure and stop after time L. If the insertion completes within time L, then the operation is finished. If the local mini-structure reports failure, or if the insertion has not completed after L time, then we say that the operation timed out. In this case, we stop the insertion and put the one currently unplaced key into the backyard. (The unplaced key may not be the key being inserted if the insertion has performed part of an eviction chain.)
Note that, if the insertion times out, then there is no need to roll back any partial eviction chain that occurred. At every moment of the chain, all placed keys are still stored in one of their legal frontyard locations; only the current key in the eviction chain is unplaced – that is the key that gets moved into the backyard.
To delete a key x, we first locate it via a query. If the key is in the backyard we delete it in time. Otherwise, we delete it from its frontyard mini-structure using the deletion protocol for the mini-structure. As before, if the procedure takes time more than L, we say that it times out, and we end the pullback procedure early. Note that this does not violate correctness (every remaining key is still stored in one of its legal locations). This may, however, violate the Uniform Overflow Invariant in the mini-structure , which may lead to future insertions incurring failures and then using the backyard.
Finally, time is divided into epochs of length insertions/deletions. At the beginning of each epoch, we rebuild the entire structure from the current live set. This rebuild is the only source of amortization, and is performed in the most straightforward way possible: It moves the keys in the data structure to a temporary secondary table, it sorts them in linear time into some arbitrary canonical order, and then it reinserts them from scratch into the original hash table.
8.2 Bounding the Number of “Bad” Mini-Structures
The main difficulty in the analysis is to bound the size of the backyard, at any given moment, with high probability. To do this, we will first focus on bounding the number of “bad” mini-structures (namely, those that may send keys to the backyard).
Fix an epoch. Let be the set of keys that are live at the beginning of the epoch or inserted at some point during the epoch. Since at most keys are live at the beginning of the epoch and the epoch contains insertions/deletions, . For each mini-structure , write
We call a mini-structure bad during the epoch if any of the following three events occurs.
-
Traffic bad: more than operations during the epoch involve keys assigned to the mini-structure. Here we count both the insertions performed during the global rebuild and the insertions/deletions during the epoch.
-
Capacity bad: at some time during the epoch, more than N live keys are assigned to the mini-structure.
-
Locally bad: before the mini-structure has already become capacity bad or traffic bad, one of its insertions or deletions times out.
Every key that is ever physically placed in the backyard during the epoch is assigned to a bad mini-structure. Indeed, a key enters the backyard only when a frontyard insertion attempt fails or times out. If the corresponding mini-structure was already capacity bad or traffic bad, then it is bad by definition. Otherwise, that failed or timed-out insertion attempt makes it locally bad. Deletion timeouts can also make a mini-structure locally bad, but they do not themselves add keys to the backyard.
We now prove three lemmas that bound the number of bad mini-structures. During the fixed epoch that we are considering, let be the set of traffic-bad mini-structures, be the set of capacity-bad mini-structures, and be the set of locally bad mini-structures.
Lemma 8.2 (Few Traffic-Bad Mini-Structures). .
Proof. The total number of local operations during an epoch, including the rebuild insertions, is at most 2n. Each traffic-bad mini-structure receives more than such operations. Therefore the lemma follows. □
Lemma 8.3 (Few Capacity-Bad Mini-Structures). With probability at least ,
Proof. Recall that there are mini-structures in total. At any given moment, for any fixed mini-structure , the number of live keys assigned to has mean at most
By a Chernoff bound,
Thus the expected number of mini-structures that are already over capacity at the beginning of the epoch is at most .
After the beginning of the epoch, a mini-structure can become capacity bad only when an insertion increases its assigned live load from to . Consider an insertion of a key that maps to mini-structure . Prior to the insertion, the probability of the mini-structure having at least live keys is, by (1), at most . The probability that the insertion causes a capacity violation is therefore also at most .
Now view as a function of the values for . Changing for a single can change the capacity-bad status of at most two mini-structures: the key's old mini-structure and its new mini-structure. Thus the function is 2-Lipschitz. McDiarmid's inequality gives
Plugging in gives
Since for a sufficiently small , and , we have and , which completes the proof.
Nonetheless, if a deletion timeout occurs then the mini-structure violates its history-independent guarantee, and we can no longer reason about future insertions. This is why we include deletion timeouts in the definition of locally bad.
Lemma 8.4 (Few Locally Bad Mini-Structures). With probability at least ,
Proof. Condition on the hash function , and also condition on the sets of capacity-bad and traffic-bad mini-structures. Consider any remaining mini-structure . During the epoch it has at most assigned live keys at all times and receives at most local operations, including the rebuild insertions.
Until the first locally bad event occurs in a, the local operation sequence seen by a is fixed by the global oblivious update sequence and by g, and is independent of the local randomness used inside a. Therefore Theorem 6.2 bounds the probability that a becomes locally bad during the epoch by at most, say, .
Conditioned on , the local randomness used by different mini-structures is independent. Hence is dominated by a sum of independent indicator random variables with total mean at most . A Chernoff bound gives
Combining Lemmas 8.2, 8.3, and 8.4, we obtain the following.
Corollary 8.5 (Few Bad Mini-Structures). For a given epoch, we have with high probability in n that the number of bad mini-structures is at most .
8.3 Bounding the Number of Backyard Keys
Having bounded the number of bad mini-structures (within a given epoch), we bound the size of the backyard by bounding the total number of keys that (during that epoch) hash to those bad mini-structures. To do this, we make use of the following lemma:
Lemma 8.6 (Largest Mini-Structures). Let keys be assigned independently and uniformly to mini-structures. Let be the load of mini-structure , and let be the sum of the largest values among . Then,
with high probability in n.
Proof. The expected number of keys, out of the , that are assigned to a given mini-structure is . By a Chernoff bound,
It follows that, for any key , the probability that hashes to a mini-structure satisfying (i.e., ignoring , we have ) is at most . Thus, if we define to be the total number of keys that hash to mini-structures with load at least , we have
Since , it follows that
Finally, observe that can be written as a function of the hashes of each of the keys . Changing a given hash value changes by at most 1, so we can apply McDiarmid's inequality to conclude that, with high probability in , . This completes the proof.
Putting the pieces together, we can now argue that the backyard does not contain too many elements (and therefore is small enough for Lemma 8.1 to apply).
Corollary 8.7 (Backyard Size). With high probability in , the number of keys in the backyard is never more than .
Proof. Since there are only poly(n) total epochs, it suffices to prove the result during a given epoch. By Corollary 8.5, the number of bad mini-structures during the epoch is at most with high probability in . By Lemma 8.6, the number of keys in the backyard is at most . Recalling that and that for a sufficiently small , we have that . Therefore the number of keys in the backyard is at most with high probability in .
8.4 Proof of Theorem 8.1
Finally, we are now in a position to prove Theorem 8.1. The frontyard uses at most slots, and the backyard uses at most slots. Thus the total number of slots is at most . The only metadata is the machine words of metadata from Lemma 8.1, and the only temporary space is the machine words of space used during rebuilds. Thus the space bounds in Theorem 8.1 are satisfied.
Next we turn to proving time bounds. Queries check the backyard and one frontyard mini-structure. The backyard query costs , and the mini-structure query costs . Thus queries take worst-case time .
Consider an insertion or deletion that is not part of a global rebuild. If the operation touches the frontyard, the frontyard procedure is stopped after time. Thus the frontyard work of any non-rebuild update is worst-case . Any backyard work costs worst-case on the success event of Lemma 8.1.
Every updates, we rebuild the entire data structure. The rebuild cost is , so rebuilds contribute amortized time per update. Therefore insertions and deletions take expected amortized time .
Finally, and most importantly, we bound the probability of the backyard failing. By Corollary 8.7, with high probability in , the backyard never contains more than keys. Recalling that , and that for a sufficiently small , it follows that the backyard never contains more than keys. Conditioned on this event, Lemma 8.1 implies that the backyard succeeds throughout the polynomial-length update sequence with high probability in . Since the only way for the overall data structure to fail is for the backyard to fail, the overall data structure succeeds with high probability in . This completes the proof.
9 Deamortizing the Rebuilds
We now explain how to remove the global rebuilds from the construction of Section 8. The goal is to obtain high-probability worst-case bounds for insertions and deletions, rather than expected amortized bounds.
The only reason that the construction in Section 8 does not already achieve high-probability worst-case time bounds is because of the time spent in rebuilds. The task in this section is to spread the work of each rebuild over the operations of that epoch. This will give us the following theorem:
Theorem 9.1 (Deamortized load factor ). Let for some sufficiently small constants . There is an open-addressed hash table using slots and 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 : With high probability in , every operation succeeds and every insertion and deletion takes worst-case time ; additionally, queries take worst-case time .
Note that the assumption is WLOG since replacing with does not change the asymptotic guarantees of the theorem. Furthermore, the requirement can be substituted with since, for , we can use Theorem 7.1 instead of Theorem 9.1. Therefore, as an immediate corollary, we have the main theorem of the paper, Theorem 1.1.
Theorem 1.1 (Main Theorem). Let . There is an open-addressed hash table using slots and 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 : With high probability in , every operation succeeds and every insertion and deletion takes worst-case time ; additionally, queries take worst-case time .
The rest of the section is spent proving Theorem 9.1.
Warmup: Performing rebuilds in-place. We begin with a simpler task: implementing the rebuild step from the previous section, but in-place, so that no temporary memory is needed. In addition, we will implement the rebuild in such a way that, if a query were to be performed at any time during the rebuild, it would still be correctly answered.
The rebuild procedure will expand the data structure to include two additional sets of slots:
-
A mirror workspace: This is an array of slots that perfectly mirrors a mini-structure. Any element y that is allowed to go in some slot s of some mini-structure is also allowed to go to slot s in the mirror workspace (queries therefore check not just but also the mirror workspace). The mirror workspace will be used as a temporary scratch space when we rebuild a mini-structure. The mirror workspace is not temporary memory – it is a permanent part of the array, and there is a single mirror workspace for the entire data structure.
-
A second backyard: Rather than one backyard, we will now have two, and . This is so that, as we perform a rebuild, which attempts to clear out one of the backyards, say, , we can put any elements that incur failures during the rebuilds (i.e., their mini-structure becomes capacity bad) into the other backyard, say . During the rebuild, we refer to the original backyard as the old backyard and the new backyard as the new backyard. At the end of the rebuild, the old backyard is empty, and the new backyard becomes the backyard in-use for the next epoch – the two backyards then swap roles during the next rebuild, and so on.
Note that these additions to the data structure consist of slots, so they do not change the overall space bound of slots.
The basic task of a rebuild is to move any keys from backyard back to the appropriate frontyard mini-structure (if we can). Naively, we can do this by scanning the backyard and attempting to insert each key into the appropriate frontyard mini-structure. However, this strategy would fail to restore correctness for mini-structures that have incurred failures – these mini-structures need to be entirely rebuilt so that they once again satisfy the Uniform Overflow Invariant.
Thus, to perform a rebuild, we take a more heavy-handed strategy. As in the naive strategy, we scan the backyard and attempt to move each key x that we encounter back to its frontyard mini-structure . But, rather than using the usual insertion rule, we instead rebuild the entire mini-structure as follows:
-
We copy the elements of the mini-structure to the mirror workspace.
-
We then scan the mirror workspace, and insert each element y in the mirror workspace back into mini-structure , but using the strongly history-independent protocol from Theorem 6.2 (really Theorem 7.1).
-
Finally, we also insert x into using the same strongly history-independent protocol.
-
If any of these insertions fail, then we declare mini-structure to be capacity bad, and we send the remaining elements in the mirror workspace to the new backyard.
Finally, a bit of extra care is needed to make sure that every failed mini-structure gets rebuilt during the rebuild. To ensure this, whenever a deletion times out during an epoch, move one element (any element in the mini-structure that timed out) to the backyard. This ensures there is a “token element” in the backyard for every mini-structure that has incurred a failure.
It is worth taking a moment to explain why we use the strongly history-independent protocol here, rather than the more efficient weakly history-independent one. One oddity of the construction above is that, as it inserts elements from the mirror workspace back into the mini-structure , the order in which they are inserted is not necessarily oblivious to their hashes in . Indeed, the order is the same as the order in which they appear in the mirror workspace, which is the same as the order they formerly appeared in . What is nice about the strongly history-independent protocol is that, unless it incurs failure, it guarantees worst-case time per operation no matter what order the elements are inserted in. Thus, if the mini-structure does not incur a failure during the rebuild, then the rebuild takes worst-case time and results in a mini-structure that satisfies the Uniform Overflow Invariant.
This concludes the description of the in-place rebuild procedure. Note that the total time taken by the procedure is at most , where is the number of elements in the backyard. Supposing , this is .
The deamortized data structure. To obtain a data structure with (high-probability) worst-case time bounds, we make one additional modification:
-
We split the data structure into equal-size (up to ) chunks of size .
-
Each element x hashes to a random chunk .
-
Each chunk then uses the construction from the previous section, with its own backyard.
-
For every R operations that occur on the data-structure as a whole, we perform a rebuild on one of the chunks (using the in-place procedure described above), rotating through the chunks so that each chunk is rebuilt every operations. The rebuild is performed using time per operation, so as long as the rebuild can complete in time , then it can complete within its scheduled window.
When a rebuild is performed, queries to that chunk proceed as usual (rebuilds never break queries); insertions directly use the new backyard (they skip the frontyard mini-structure); and deletions either use the appropriate backyard (if the key is in a backyard) or delete the key from the appropriate frontyard mini-structure (or mirror workspace) without doing anything else.
This approach guarantees that insertions/deletions/queries to the chunk being rebuilt take worst-case time . On the other hand, this also means that, when a key x that hashes to the chunk being rebuilt is inserted/deleted, we do nothing to try to maintain the Uniform Overflow Invariant for that key x's frontyard mini-structure . Declare such a frontyard mini-structure to be data-race bad.
We will, as part of the analysis, argue that there are very few data-race bad mini-structures during the rebuild of any given chunk.
Avoiding a blowup in backyard metadata. A naive application of the construction above would seem to multiply the metadata used by Lemma 8.1 (i.e., the backyard) by the number of chunks. However, so long as the backyard dictionaries all stay under capacity, then they can all share a single set of machine words of metadata. This metadata is just used to keep track of the queue/stash/cycle-detection-mechanism in the construction of [ANS09]. For two of these sources of metadata, the queue size and the cycle-detection-mechanism size, the bound of proven in [ANS09] applies equally well to the setting where, as here, the hash table is broken into polynomial-size chunks.
Thus the only minor point of trickiness is the number of “stash” elements, i.e., elements that have incurred a genuine failure (they are in a bicyclic component) in one of the backyard cuckoo hash tables during the most recent operations. The standard analysis (e.g., Theorem 2.1 of [KMW10] or Lemma 4.5 of [ANS09]) shows that the number of such elements per chunk is with high probability in ; moreover, the expected number of elements per chunk (based only on the randomness in that chunk) is, by the standard analysis of cuckoo hashing, . Summing over the chunks, the total number of stash elements is a sum of independent -random variables with total mean , and is therefore with high probability in .
Thus, even though we now have many backyards, they can collectively use just machine words of metadata.
Analysis. To analyze the deamortized data structure, the main technical challenge (just as in the previous section) is to argue that no backyard ever becomes overly full.
Focus on a given chunk Q, and define an epoch for that chunk to be the period of time starting from the last rebuild (and including that rebuild) up until the start of the next rebuild (not including that rebuild). Define the operation sequence for the chunk, during the epoch, to be the operations on keys that hash to that chunk.
Unlike in the previous section, the epoch for chunk Q is not guaranteed to have exactly operations. The next lemma splits elements into heavy hitters and light hitters, and argues that the number of operations on light hitters is with high probability in n.
Lemma 9.1. Let Q be a chunk of size . Let H be the set of keys that hash to Q and experience at least insertions/deletions during the epoch (the heavy hitters), and let L be the set of keys that hash to Q and experience fewer than insertions/deletions during the epoch (the light hitters). Then, with high probability in n,
• The number of keys in H is ;
• The number of insertions/deletions on keys in L, during the epoch, is .
Proof. During the epoch, at most insertions/deletions occur overall, so there are at most elements that incur at least insertions/deletions. Each of these hashes to Q with probability , so is a sum of iid 0-1 random variables with total mean . Since (by the assumption that is at most a small polynomial of n), we have by a Chernoff bound that is with probability .
On the other hand, the number of insertions/deletions on keys in , during the epoch, is a sum of independent (non-iid) -random variables with total mean (one random variable for each key that is accessed fewer than times during the epoch). By assumption, , so a standard Chernoff bound gives that this number is with probability at least .
Define traffic-bad mini-structures, capacity-bad mini-structures, and locally-bad mini-structures as in the previous section. Also define data-race bad mini-structures as above. Any mini-structure that sends any keys to the backyard during the epoch is guaranteed to be bad in one of these ways. Note that any heavy hitter (as defined above) is guaranteed to be in a traffic-bad mini-structure.
The bounds on the number of capacity-bad mini-structures and locally-bad mini-structures follow exactly as in the previous section: with high probability in n, there are at most such mini-structures.
The bound on the number of traffic-bad mini-structures is also straightforward (assuming the high-probability event from Lemma 9.1): Any traffic-bad mini-structure either has at least one key from H that hashes to it (there are at most such keys); or receives at least operations on keys from L (since the total number of operations on keys in L is by Lemma 9.1, there can be at most such mini-structures). Therefore, with high probability in n, there are at most traffic-bad mini-structures.
Finally, we can bound the number of data-race bad mini-structures as follows:
Lemma 9.2. With high probability in n, there are at most data-race bad mini-structures.
Proof. Recall that the rebuild spans operations (in the whole data structure). Let S be the set of keys accessed by these operations. Each key in S independently has probability of hashing to chunk Q. So the number of such keys that hash to Q is at most a sum of iid 0-1 random variables with mean . By a Chernoff bound, such a sum is with high probability in n. The number of data-race bad mini-structures is therefore also with high probability in n.
Putting the bounds together, the total number of bad mini-structures in chunk Q, during a given epoch, is at most with high probability in n. By the same argument as in Lemma 8.6, we can conclude that, of the keys in L, at most hash to bad mini-structures (with high probability in n). Combining these with the keys in H, the total number of keys that hash to bad mini-structures in Q during the epoch, and therefore the size of the backyard, is at most with high probability in n.
Applying a union bound over all chunks and all epochs, we can conclude that, with high probability in n, no backyard ever has more than keys in it. This means that each backyard meets the requirements for Lemma 8.1, offering time operations with high probability in (and therefore also in ). This bound also means that the time per rebuild is , meaning that each rebuild can successfully complete within its scheduled window.
By the design, the new data structure offers worst-case time operations (with high probability in n), so Theorem 9.1 follows.
10 A Lower Bound on Insertion/Deletion Time
In this section, we prove that any open-addressed hash table with worst-case query time must also move keys per insertion/deletion, on average. To reason about an arbitrary open-addressed hash table, we will use the following abstraction. Each key has a probe set , determined by its hash value, and the table may store only in cells of . A worst-case successful query bound of means that for every key .
Throughout the section, all logarithms are base two. We suppress floors and ceilings, as they do not affect the asymptotics. A move means relocating a key that is already present in the table; the initial placement of a newly inserted key is not counted.
Theorem 10.1. Let an open-addressed hash table have cells and load factor , where for a sufficiently small constant . Suppose every key is stored in one of at most possible cells. Starting from any configuration with keys, delete uniformly random stored keys and then insert new keys. Then the expected total number of moves during this sequence is
Consequently, the expected number of moves per update is
Proof. The proof is a one-way communication argument. The encoder knows the deletion set D, runs the update sequence, and sends a binary message to a decoder who does not know D. The encoder and decoder are both given, for free, the initial table layout, the probe sets of all keys, and the sequence of inserted keys. If the data structure is randomized, we also give its random tape to both parties; equivalently, we prove the bound after conditioning on the tape and then average over it.
At a high level, the message will describe certain displacement paths in the final table. These paths allow the decoder to recover many members of . If few keys are moved, we will be able to guarantee that the message encoding the paths is very short (roughly times the number of moves bits). On the other hand, any message that reveals many keys of must have large entropy. Comparing these two bounds is what ultimately gives the theorem.
Label the initially stored keys by , and let
be the uniformly random deletion set. We write for Shannon entropy and for mutual information. Since is a uniform -subset of ,
Let be the set of initially empty cells, so . For an old key (i.e., a key that was stored in the initial configuration), let denote its initial cell. For any key present in the final table, let denote its final cell.
We now define a collection of displacement paths by comparing the initial and final layouts.
For each inserted key , we will have one path starting from . A path will specify a sequence of elements and positions such that ; such that , for , is an old key that was initially in position and is now (in the final table) in position ; and such that is a slot that was either empty in the initial table or that contained a key in .
Starting from , we define , and we construct the displacement path incrementally as follows. Given a point in the path: If or for some , then the path ends at ; and otherwise, we define to be the old key with , and we define to be . By continuing this construction until it completes, we get the full displacement path starting from .
We remark that the paths above are non-cyclic and non-overlapping (both in terms of the keys and the positions they visit). The key observation is that paths are reversible: the predecessor of on its path is the unique key with , so given any point on a path, together with the initial and final configurations of the hash table, we can rebuild the path backwards. In particular, every key has at most one predecessor, and the inserted key has none. If a path revisited a key, then the first revisited key would either be y or have two distinct predecessors, both of which are impossible. And if two paths shared a key, then rebuilding backwards from that key would lead to a single starting key, so the paths would be the same. Therefore the paths are both non-cyclic and non-overlapping.
Thus the inserted keys define disjoint paths, each terminating either at an initially empty cell or at the initial cell of a deleted key. The endpoints are distinct. Since only endpoints can be initially empty cells, at least
paths terminate at cells that initially contained deleted keys. Hence the paths identify a subset
of size at least
Let P be the number of old surviving keys (keys present both initially and in the final configuration) that appear on these displacement paths. Every such key must move between the initial and final configuration, so the total number of moves T must satisfy
The encoder now sends a displacement transcript that encodes the paths as follows. The paths are listed in the order of the insertions. For each key appearing on a path (including the element being inserted), the transcript records the index of within , together with one bit indicating whether the path stops at that cell. Thus each step in the path costs
bits. The total number of steps is : one step for each inserted key, and one additional step for each old surviving key on the paths. Hence
Given and the public side information, the decoder reconstructs the paths as follows. The decoder knows the key at the start of the path (the key that is inserted), and can recover from the message which position in is . Then, given some in the path and the position , the decoder can continue to recover the path as follows: If the stop bit for the path is not set, then the cell must have initially contained some old key with . This key is , and using the information in the message, the decoder can recover which position in is . This position is . Continuing like this, the decoder can recover the entire path starting from .
Having recovered the paths, the decoder knows that any path ending in a cell that was not initially empty must instead end in a cell whose initial key is in . Therefore determines a set with
We now lower-bound the entropy of the transcript. The transcript is prefix-free: each step has fixed length b, the decoder knows that there are exactly r paths, and the stop bits tell it exactly where each path ends. Hence the standard source-coding inequality gives
Since the random tape, if any, has been fixed, is a deterministic function of . Thus
For any fixed transcript , the deletion set must contain the revealed set , and . Therefore the number of deletion sets consistent with is at most
Consequently,
Combining the last three displays,
Since , this gives
It remains to estimate the entropy gap. Using , , and ,
For every ,
Thus, for sufficiently small ,
Therefore
Since , we obtain
Because ,
Finally, , so
For sufficiently small , the first term dominates the subtraction, and therefore
Since , the same lower bound holds for the expected total number of moves. Dividing by the updates gives the claimed per-update bound.
11 Proof of the Static Placement Theorem
In this section, we present the full proof of the Static Placement Theorem. We begin in Subsection 11.1 with a review of some (relatively) standard properties of sub-Gaussian random variables. We then show in Subsection 11.2 how to leverage these properties to prove the theorem.
11.1 Properties of Sub-Gaussian Random Variables
A real-valued random variable X with mean zero is called sub-Gaussian with variance if its moment-generating function satisfies
In this case, we write
More generally, for an arbitrary random variable Y, we write
to denote that and ; that is, is sub-Gaussian with mean and variance .
We will routinely use the following standard equivalence between sub-Gaussian moment-generating-function bounds and Gaussian-type tail bounds.
Lemma 11.1 (Sub-Gaussian tails and MGF bounds). Let Y be a random variable with .
- If , then for every ,
- Conversely, there is an absolute constant C > 0 such that if there exists v > 0 with
then .
The proof of Lemma 11.1 is deferred to Appendix B. We will also use the following standard closure properties of sub-Gaussian random variables.
Lemma 11.2 (Sums of independent sub-Gaussians). Let be independent random variables satisfying . Then
Proof. By replacing each with , we may assume without loss of generality that for every ; the general statement then follows by adding back , which only shifts the mean. So assume each . For every , independence gives
Lemma 11.3 (Scaling). If and , then . Equivalently, if , then .
Proof. For every ,
In addition to the closure properties, we will need several additional standard results. The first is the fact that binomial random variables (with ) are sub-Gaussian.
Lemma 11.4 (Binomial sub-Gaussianity). Let . Then . Equivalently, .
Proof. Write , where the 's are independent Bernoulli(1/3) random variables. Each centered summand is supported on an interval of length 1. By straightforward calculation,
The result follows from Lemma 11.2.
Next, we consider what happens when we clip a sub-Gaussian random variable to a bounded range. The result, not surprisingly, is still sub-Gaussian with essentially the same variance; and, if the original mean was far from the clipping boundaries, then the mean is essentially preserved as well.
Lemma 11.5 (Clipping a sub-Gaussian). Let , and define
Then
Moreover, for any constant , there exists a constant , depending only on , such that if and
then
The proof of Lemma 11.5 is deferred to Appendix C.
Finally, we will also need the following two slightly more specialized results. The first says that, even though Poisson random variables are not sub-Gaussian (because their tails are too fat), they can (in some parameter regimes) be coupled to a random variable that is.
Lemma 11.6 (Sub-Gaussian coupling for a Poisson random variable). There exist absolute constants such that the following holds. Let with . Then there exists a random variable , coupled with , such that , , and . Moreover, may be chosen to be integer-valued.
The proof of Lemma 11.6 is deferred to Appendix D.
The final lemma considers what happens if we take a non-negative integer-valued sub-Gaussian random variable X and replace it with (this is analogous to taking the overflow from a bin and deciding which of the elements should be forwarded to a given ). Here, critically, the result is not just sub-Gaussian, but it is sub-Gaussian with a smaller variance (assuming the original variance was large enough).
Lemma 11.7 (Sub-Gaussianity under binomial thinning). Let be a nonnegative integer-valued random variable such that (in particular ), and suppose that almost surely. Conditional on , let . Then
The proof of Lemma 11.7 is deferred to Appendix E.
11.2 Proof of the Static Placement Theorem
Having reviewed the properties of sub-Gaussian random variables, we now turn to the proof of the Static Placement Theorem, restated below for convenience.
Theorem 5.1 (Static placement theorem). Suppose the constant c used in the construction is sufficiently large. Then with high probability in n, the following events hold simultaneously.
- For every layer with , and every bin , the number of elements forwarded into from layer satisfies
Notably, this means that no element is ever forwarded to a bin that is already full.
- After all n elements have been placed, the only remaining free slots are in the final layer .
We first prove the theorem in a Poissonized model, where rather than assuming n elements, we assume that the number of elements is a Poisson random variable
with mean n. These elements are then placed into the hash table using the same construction as in the fixed-n model.
For a bin q, let
denote the number of elements whose first hash is we refer to as the primary-arrival variable for bin . Under Poissonization, the variables are independent Poisson random variables.
For , let
denote the number of elements forwarded into from layer , with for . For , , let
denote the number of elements overflowed out of q and forwarded to .
Before continuing, it will be helpful to compute the expectations of the primary-arrival variables. For ,
For , where ,
Finally, for , we have since no elements have first hashes in the final layer.
Analyzing a proxy process. We now define an auxiliary process that is easier to analyze. For each non-final bin , we couple to an integer-valued random variable using the Poisson Sub-Gaussian Coupling Lemma (Lemma 11.6). Thus, if
then
and
where are absolute constants. We take these couplings independently over all bins.
The proxy process is defined recursively. For bins , set
For a non-final bin q, define its proxy pre-overflow quantity by
and define its proxy overflow by clipping:
Conditioned on , the proxy process sends elements independently and uniformly to the three bins in the next layer allowed by the definition of . For a bin , let
denote the number sent from q to r. Thus, whenever r is one of the three possible destinations of q,
Finally, for , define
where is the set of predecessor bins in that can forward to . This represents the number of elements forwarded into from the previous layer in the proxy process.
Note that this proxy process differs from the true process in only two ways: (1) each is replaced with , and (2) the number of balls that overflow out of a bin is artificially truncated to at most . At the end of the analysis, we will show that, with high probability in , neither of these distinctions ever matters (the two processes behave exactly the same). Until then, however, it will be more convenient to reason about the proxy process.
Local independence of predecessor bins. We now argue that, within the proxy process, if we focus on a given bin (for some ), then the behaviors of 's predecessor bins are mutually independent. Lemma 11.8 (Local independence of predecessor overflows). Fix , and let . Let be the set of bins in layer from which an element may be forwarded to . Then and the proxy overflow variables are mutually independent. Finally, conditioned on the value of , the number of proxy elements forwarded from to is distributed as , independently over .
Proof. First consider the size of . A bin can forward to only if deleting the final bit of the address of , and then changing the bit-pair in positions
produces the address of . There are three possible original values for this bit-pair, since it must be different from the pair in , and there are two possible values for the deleted bit. Hence .
We now prove the independence claim. For a bin u, let
denote the set of bins whose primary-arrival variables can influence the proxy overflow (so consists of the predecessors of , the predecessors of those predecessors, etc.). We claim that, for the six bins , the sets
are pairwise disjoint. Since the proxy primary-arrival variables are mutually independent, this implies that the overflows
are mutually independent.
We prove the disjointness claim by describing . Let . The overflow is determined by the proxy primary arrivals in the bins that can reach through the first forwarding steps. Equivalently, consists of those bins in layers
whose address can be transformed into the address of u by repeatedly applying the earlier layer transitions. Crucially, the earlier transitions use only the bit-pairs
and delete only one trailing bit at each step. They do not inspect or modify the fresh bit-pair
used in the transition from to .
The six bins in differ from one another either in this fresh bit-pair , or in the final bit that is deleted in the transition to . Since neither of these bits is touched by any earlier transition, any bin that can reach one predecessor through earlier transitions cannot also reach a different predecessor . Thus
This proves the disjointness claim, and hence the mutual independence of the proxy overflows .
Finally, in the proxy process, conditioned on , each of the overflowed proxy elements independently chooses one of the three allowed destinations in the next layer uniformly at random. Therefore the number sent from to the fixed bin q is
and this is independent over the six bins .
Analyzing overflow variances. We now prove the most important result of the analysis: that the overflow random variables are sub-Gaussian with variance .
Lemma 11.9 (Variance invariant). There is an absolute constant C > 0 such that the following holds for the proxy process.
For every non-final bin q,
Moreover, for every bin , ,
Proof. Let be the absolute constant from the Poisson Sub-Gaussian Coupling Lemma (Lemma 11.6). Choose large enough that
and
This is possible because the coefficient of C in the second inequality is .
We prove the statement by induction over the layers. We begin with the base case of . For , we have , and
Thus
has sub-Gaussian variance at most CB. Since
the Clipping Lemma (Lemma 11.5) gives
Now consider a bin , where , and assume the invariant has been proved for layer . By the Local Independence of Predecessor Bins Lemma (Lemma 11.8), has six independent predecessors. For each , conditioned on ,
Since
and
the Sub-Gaussianity under Binomial Thinning Lemma (Lemma 11.7) gives
Summing over the six independent predecessors and using the Sums of Independent Sub-Gaussians Lemma (Lemma 11.2), we obtain
Equivalently,
This gives us the desired result for , and it remains to consider (in the case where ). Recall that
Therefore, by the Sums of Independent Sub-Gaussians Lemma (Lemma 11.2),
has variance at most
Applying the Clipping Lemma (Lemma 11.5) to
gives
which completes the proof.
Analyzing overflow means. We next compute the means in the proxy process. By symmetry, all bins in the same layer have the same proxy-overflow mean. Let
Lemma 11.10 (Proxy mean invariant). There is a constant such that the following holds. Define
and define
Assume that
Then, for every non-final layer ,
for some deterministic satisfying
Proof. Choose small enough so that the Clipping Lemma (Lemma 11.5) applies with variance CB and gives mean shift at most
We prove the claim by induction.
For ,
Moreover, by Lemma 11.9,
has variance at most CB. The mean lies far from both clipping thresholds 0 and B, so the Clipping Lemma (Lemma 11.5) gives
Thus .
Now suppose , and assume
For , the expected forwarded load is
The expected primary-arrival proxy is , so
Since
this mean lies in . By the Variance Invariant (Lemma 11.9), has variance at most CB. Hence the Clipping Lemma (Lemma 11.5) gives
Writing
we get
and therefore
This completes the induction.
Recall that the bin size is given by for some large positive constant . Moreover, the constants used in the previous arguments are all independent of . Therefore, we may treat those constants as fixed, and take to be sufficiently large. Doing so, we can argue that the error sequence in Lemma 11.10 is negligible. Since
and
we have
Because , choosing sufficiently large ensures that
In particular, the hypothesis
from Lemma 11.10 holds for every .
Proving the theorem in the Poissonized model. We now have all the pieces necessary to prove the theorem in the Poissonized model.
Lemma 11.11 (Poissonized static placement). In the Poissonized model, the conclusions of the Static Placement Theorem hold with probability at least , for any desired constant , provided the constant in is chosen sufficiently large.
Proof. Let G be the event that all of the following hold simultaneously.
- For every non-final bin q,
- For every bin , ,
- For every non-final bin q,
Note that, should occur, then the proxy process and the true process behave exactly the same. Indeed, the only differences between the two processes are that (1) each is replaced with , and (2) the number of balls that overflow out of a bin is artificially truncated to at most . If occurs, then these differences never matter.
Now, let us reason about the probability of failing. There are bins in total. The first condition fails for a fixed bin with probability , by the Poisson Sub-Gaussian Coupling Lemma (Lemma 11.6).
For the second condition, the variance and mean invariants imply
and
Thus
For the third condition, the variance and mean invariants imply
and
Thus
By a union bound over all bins, the event holds with probability at least
Choosing sufficiently large makes this at least .
It remains to check that, on , the proxy process (and therefore the true process) satisfies the theorem's conclusions. Because the two processes are identical on , we will use the proxy-process variables and the true-process variables interchangeably. On , every forwarded element is successfully placed, because every bin receives at most
forwarded elements. Also, every non-final bin fills during its own phase, because
implies
Finally, from the second condition of , we have
for every bin after the first layer, which is the final property required by the theorem.
De-Poissonizing. It remains to de-Poissonize. Let be the event that the theorem's three conclusions hold. In the Poissonized model, conditioned on , the hash choices have exactly the same distribution as in the original fixed-n model. Hence
Therefore
By Stirling's formula,
Thus, if the Poissonized failure probability is at most , then the fixed-n failure probability is at most . Since was arbitrary, the theorem follows with failure probability .
11.3 Analyzing Keys
We now consider what happens when the table, constructed for capacity parameter n, is used to store only keys. The hash functions and layer probabilities are still those defined using the original parameter n. Thus, compared to the preceding section, the table layout is unchanged, but fewer keys are inserted. Our goal is to prove Theorem 5.2, restated below for convenience.
Theorem 5.2 (Static placement with fewer than n keys). Suppose the constant c used in the construction is sufficiently large. Fix any , and run the static placement process on keys in the table constructed for parameter n. There is an absolute constant such that, with high probability in n, the following events hold simultaneously.
-
Every forwarded element is successfully placed in its second-choice bin, and for bins in layers , , the number of elements forwarded into from layer satisfies .
-
Every bin in the final layer has at least one free slot.
-
For every layer with , and every bin , either has a free slot after the placement process completes, or
Proof. We prove the theorem for a fixed value of . We begin by arguing that the first two conclusions are monotonic consequences of the Static Placement Theorem.
Fix the oblivious tie-breaking rule used inside each bin: among elements with the same first-choice bin, the rule deciding which elements stay and which are forwarded is independent of their second hashes.
Under any such fixed rule, the placement process is monotone under deletion of keys. More precisely, if we run the process on a set of keys and on a subset , then, by induction over the phases, every bin receives no more forwarded elements in the run on than in the run on . Indeed, in a given bin, deleting keys can only decrease the number of elements already present and can only decrease the number of primary arrivals. Therefore the set of primary arrivals forwarded out of that bin is a subset of the set that would have been forwarded in the larger run.
Now couple the -key instance with an -key instance by adding independent extra keys. Whenever the -key instance satisfies the Static Placement Theorem, the -key instance also has no failed forwarded placement, and every for every bin in layers , , is at most . Moreover, since every bin in the final layer has at most as many elements in the -key run as in the -key run, and every final-layer bin has at most forwarded elements in the successful -key run, all final-layer bins have free slots in the -key run. Thus the first two claims hold with probability .
It remains to prove the third claim. We use the same Poissonization and proxy process as in the proof of the Static Placement Theorem. Namely, we first consider a Poissonized model with
keys, and then de-Poissonize at the end. The proxy process is defined exactly as before, except that the primary-arrival variables now have smaller means: if
then for ,
and for , ,
The variance argument from Lemma 11.9 continues to apply without change, since it only uses the fact that the primary-arrival variables have sub-Gaussian variance , and these proxies only get smaller when .
In particular, there is a constant such that, in the Poissonized proxy process, for every directed predecessor edge ,
and for every non-final bin q,
Moreover, the proxy process agrees with the true process with probability , by the same comparison argument as in Lemma 11.11: the probabilities that , that an upper truncation is active, or that a forwarded load exceeds , are all per bin, and there are only bins.
Let
Since , by taking sufficiently large and applying a union bound over all bins and all predecessor edges, we may assume that the following events hold simultaneously with probability :
-
The proxy process and the true process agree.
-
For every directed predecessor edge ,
- For every bin , ,
For final-layer bins, , so the third condition is not needed there.
We now show that these events imply the desired structural property. Fix with . If has a free slot, there is nothing to prove. So suppose is full.
By the second conclusion already proved, every final-layer bin has a free slot. Hence cannot lie in ; we must have . Since is full,
By the third good event,
Therefore
By symmetry, the six random variables
have the same expectation. Let this common expectation be . The second good event gives
Since ,
Thus
Using , this gives
Applying the second good event again,
Thus the theorem holds with, for example,
This proves the theorem in the Poissonized model with failure probability . To pass to the fixed- model, condition on the event . For ,
Thus a polynomially small failure probability in the Poissonized model remains polynomially small after conditioning. This completes the proof.
12 Conclusion
The price of cuckoo hashing’s worst-case queries has always been slow insertions: the best known bound was expected time [KM25], which was conjectured to be optimal up to polylogarithmic factors [BKZ24]. Braided cuckoo hashing removes this cost, supporting insertions and deletions in worst-case time while preserving the worst-case query time. Perhaps the largest remaining impediment to realizing these gains in practice is the constant factor on the number of probes a query makes: d-ary cuckoo hashing [FP10, DGM 10] supports queries using probes, which is optimal even among static hash tables by a simple counting argument. This leaves the following important open question: is an insertion/deletion time of possible such that all queries use probes?
The following additional questions also warrant investigation. Can braided cuckoo hashing be extended to support (i) dynamic resizing? (ii) an expected query time of ? (iii) a load factor of exactly 1? (iv) dynamically adapting insertion, deletion, and/or query times as varies? We expect that (i) can be implemented using the same basic approach as in [BKZ24], but there are many details one would need to work out, so we have deferred it to future work. The construction of [BKZ24] also provides a potential approach to (ii): by using their construction in each bin, it would seem the expected query time could be brought to . However, this would increase the expected insertion time by a factor and the worst-case insertion time by a potentially much larger factor. (iii) and (iv) would seem to require new techniques.
Acknowledgments
This work was partially supported by the Jeanne B. and Richard F. Berdik ARCS Pittsburgh Endowed Scholar Award, NSF grants CNS-2504471 and CCF-2542165, a Jane Street Research Grant, the David and Lucile Packard Foundation (Award #202071730), and gifts from Nikolai Mushegian and Microsoft.
Several of the technical sections in this paper were written with the help of GPT 5.5 Pro, which was used to turn detailed section outlines into initial drafts. These initial drafts were then heavily edited by the authors of the paper. Claude Opus 5.5 was used to check the paper for grammatical errors and to polish the writing.
References
[ABKS26] Amir Azarmehr, Michael A Bender, William Kuszmaul, and Rose Silver. The power of two-choice linear probing. arXiv preprint arXiv:2610.00688, 2026.
[ABKU94] Yossi Azar, Andrei Z Broder, Anna R Karlin, and Eli Upfal. Balanced allocations. In Proceedings of the twenty-sixth annual ACM symposium on theory of computing, pages 593–602, 1994.
[ANS09] Yuriy Arbitman, Moni Naor, and Gil Segev. De-amortized cuckoo hashing: Provable worst-case performance and experimental results. In International Colloquium on Automata, Languages, and Programming, pages 107–118. Springer, 2009.
[ANS10] Yuriy Arbitman, Moni Naor, and Gil Segev. Backyard cuckoo hashing: Constant worst-case operations with a succinct representation. In 2010 IEEE 51st Annual Symposium on Foundations of Computer Science, pages 787–796, 2010.
[BBK 23] Ioana O Bercea, Lorenzo Beretta, Jonas Klausen, Jakob Bæk Tejs Houen, and Mikkel Thorup. Locally uniform hashing. In 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pages 1440–1470. IEEE, 2023.
[BCFC 22] Michael A Bender, Alex Conway, Martín Farach-Colton, Hanna Komlós, William Kuszmaul, and Nicole Wein. Online list labeling: Breaking the log 2 n barrier. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 980–990. IEEE, 2022.
[BCFC 23] Michael A Bender, Alex Conway, Martín Farach-Colton, William Kuszmaul, and Guido Tagliavini. Iceberg hashing: Optimizing many hash-table criteria at once. Journal of the ACM, 70(6):1–51, 2023.
[BCFC 25] Michael Bender, Alex Conway, Martín Farach-Colton, William Kuszmaul, and Guido Tagliavini. Tiny pointers. ACM Transactions on Algorithms, 21(4):1–43, 2025.
[BCSV00] Petra Berenbrink, Artur Czumaj, Angelika Steger, and Berthold Vöcking. Balanced allocations: The heavily loaded case. In Proceedings of the thirty-second annual ACM symposium on Theory of computing, pages 745–754, 2000.
[BDH 19] Soheil Behnezhad, Mahsa Derakhshan, MohammadTaghi Hajiaghayi, Cliff Stein, and Madhu Sudan. Fully dynamic maximal independent set with polylogarithmic update time. In 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS), pages 382–405. IEEE, 2019.
[BF24] Tolson Bell and Alan Frieze. O(1) insertion for random walk d-ary cuckoo hashing up to the load threshold. In 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS), pages 106–119. IEEE, 2024.
[BFCK 22] Michael A Bender, Martín Farach-Colton, John Kuszmaul, William Kuszmaul, and Mingmou Liu. On the optimal time/space tradeoff for hash tables. In Proceedings of the 54th Annual ACM SIGACT Symposium on Theory of Computing (STOC), pages 1284–1297, 2022.
[BHK 26] Guy E Blelloch, Yang Hu, William Kuszmaul, Jingxun Liang, and Renfei Zhou. Optimal time-space tradeoff for dynamic difference-encoded dictionaries. arXiv preprint arXiv:2608.06077, 2026.
[BK70] James R Bell and Charles H Kaman. The linear quotient hash code. Communications of the ACM, 13(11):675–676, 1970.
[BK22] Nikhil Bansal and William Kuszmaul. Balanced allocations: The heavily loaded case with deletions. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 801–812. IEEE, 2022.
[BK24] Mark Braverman and William Kuszmaul. Tight analyses of ordered and unordered linear probing. In 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS), pages 606–635. IEEE, 2024.
[BK26] Tolson Bell and William Kuszmaul. Fast insertion for bucketized cuckoo hashing. arXiv preprint arXiv:2607.24545, 2026.
[BKK22] Michael A Bender, Bradley C Kuszmaul, and William Kuszmaul. Linear probing revisited: Tombstones mark the demise of primary clustering. In 2021 IEEE 62nd Annual Symposium on Foundations of Computer Science (FOCS), pages 1171–1182. IEEE, 2022.
[BKSS26] Michael A Bender, William Kuszmaul, Elaine Shi, and Rose Silver. History-independent load balancing. In Proceedings of the 2026 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1097–1127. SIAM, 2026.
[BKZ24] Michael A Bender, William Kuszmaul, and Renfei Zhou. Tight bounds for classical open addressing. In 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS), pages 636–657. IEEE, 2024.
[BKZ25] Michael A Bender, William Kuszmaul, and Renfei Zhou. Optimal non-oblivious open addressing. In Proceedings of the 57th Annual ACM Symposium on Theory of Computing (STOC), pages 268–277, 2025.
[Bre73] Richard P Brent. Reducing the retrieval time of scatter storage techniques. Communications of the ACM, 16(2):105–109, 1973.
[CZ19] Shiri Chechik and Tianyi Zhang. Fully dynamic maximal independent set in expected poly-log update time. In 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS), pages 370–381. IEEE, 2019.
[DdHPP06] Erik D Demaine, Friedhelm Meyer auf der Heide, Rasmus Pagh, and Mihai Pătrașcu. De dictionariis dynamicis pauco spatio utentibus: (lat. on dynamic dictionaries using little space). In Latin American Symposium on Theoretical Informatics, pages 349–361. Springer, 2006.
[DGM 10] Martin Dietzfelbinger, Andreas Goerdt, Michael Mitzenmacher, Andrea Montanari, Rasmus Pagh, and Michael Rink. Tight thresholds for cuckoo hashing via xorsat. Proceedings of the 37th International Colloquium Conference on Automata, Languages and Programming (ICALP), pages 213–225, 2010.
[Die07] Martin Dietzfelbinger. Design strategies for minimal perfect hash functions. In International Symposium on Stochastic Algorithms, pages 2–17. Springer, 2007.
[DK26] Rathish Das and William Kuszmaul. History-independent maximal matchings can be surprisingly efficient, and lead to better worst-case guarantees. In Proceedings of the 2026 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 3999–4022. SIAM, 2026.
[DKRT15] Søren Dahlgaard, Mathias Bæk Tejs Knudsen, Eva Rotenberg, and Mikkel Thorup. Hashing for statistics over k-partitions. In 2015 IEEE 56th Annual Symposium on Foundations of Computer Science, pages 1292–1310. IEEE, 2015.
[DR09] Martin Dietzfelbinger and Michael Rink. Applications of a splitting trick. In International Colloquium on Automata, Languages, and Programming, pages 354–365. Springer, 2009.
[DW07] Martin Dietzfelbinger and Christoph Weidling. Balanced allocation and dictionaries with tightly packed constant size bins. Theoretical Computer Science, 380(1):47–68, 2007.
[EGMP14] David Eppstein, Michael T. Goodrich, Michael Mitzenmacher, and Paweł Pszona. Wear minimization for cuckoo hashing: How not to throw a lot of eggs into one basket. Proceedings of the International Symposium on Experimental Algorithms (SEA), pages 162–173, 2014.
[FCKK24] Martin Farach-Colton, Andrew Krapivin, and William Kuszmaul. Optimal bounds for open addressing without reordering. In 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS), pages 594–605. IEEE, 2024.
[FCKK26] Martin Farach-Colton, Andrew Krapivin, and William Kuszmaul. Greedy open addressing revisited: Beyond yao's lower bound. In Proceedings of the 58th Annual ACM Symposium on Theory of Computing, pages 1116–1127, 2026.
[FJ17] Alan Frieze and Tony Johansson. On the insertion time of random walk cuckoo hashing. Proceedings of the 2017 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1497–1502, 2017.
[FMM09] Alan Frieze, Pål Melsted, and Michael Mitzenmacher. An analysis of random-walk cuckoo hashing. Proceedings of the 2009 International Conference on Randomization and Computation (RANDOM), 2009.
[FN93] Amos Fiat and Moni Naor. Implicit O(1) probe search. SIAM Journal on Computing, 22(1):1–10, 1993.
[FNSS92] Amos Fiat, Moni Naor, Jeanette P Schmidt, and Alan Siegel. Nonoblivious hashing. Journal of the ACM, 39(4):764–782, 1992.
[FP10] Nikolaos Fountoulakis and Konstantinos Panagiotou. Orientability of random hypergraphs and the power of multiple choices. Proceedings of the 37th International Colloquium Conference on Automata, Languages and Programming (ICALP), pages 348–359, 2010.
[FPS13] Nikolaos Fountoulakis, Konstantinos Panagiotou, and Angelika Steger. On the insertion time of cuckoo hashing. SIAM Journal on Computing, 42(6):2156–2181, 2013.
[FPSS05] Dimitris Fotakis, Rasmus Pagh, Peter Sanders, and Paul G. Spirakis. Space efficient hash tables with worst case constant access time. Theory of Computing Systems, 38(2):229–248, 2005.
[GHMT12] Michael T Goodrich, Daniel S Hirschberg, Michael Mitzenmacher, and Justin Thaler. Cache-oblivious dictionaries and multimaps with negligible failure probability. In First Mediterranean Conference on Algorithms (MedAlg 2012), pages 203–218, 2012.
[GPW26] Yuhao Guo, Seth Pettie, and Chengzhang Wan. A simple analysis of quadratic probing and other open addressing schemes. arXiv preprint arXiv:2608.08013, 2026.
[GS76] Leo J Guibas and Endre Szemeredi. The analysis of double hashing. In Proceedings of the eighth annual ACM symposium on Theory of computing, pages 187–191, 1976.
[HD72] F Robert A Hopgood and J Davenport. The quadratic hash method when the table size is a power of 2. The Computer Journal, 15(4):314–315, 1972.
[HH01] Erik E Hagersten and Mark D Hill. Shared memory system for symmetric multiprocessor systems, May 1 2001. US Patent 6,226,671.
[HKL 26a] Yang Hu, William Kuszmaul, Jingxun Liang, Stefan Walzer, Huacheng Yu, and Renfei Zhou. Quadratic probing insertions are time. arXiv preprint arXiv:2608.28512, 2026.
[HKL 26b] Yang Hu, William Kuszmaul, Jingxun Liang, Stefan Walzer, Huacheng Yu, and Renfei Zhou. Quadratic probing revisited: Smoothed analysis and the fall of Robin Hood. arXiv preprint arXiv:2607.13247, 2026.
[JP08] Morten Skaarup Jensen and Rasmus Pagh. Optimality in external memory hashing. Algorithmica, 52(3):403–411, 2008.
[KA19] Megha Khosla and Avishek Anand. A faster algorithm for cuckoo insertion and bipartite matching in large graphs. Algorithmica, 81(9):3707–3724, 2019.
[KKW26] Andrew Krapivin, William Kuszmaul, and Yixuan Wang. Linear probing with non-greedy insertions. arXiv preprint arXiv:2607.17494, 2026.
[KM25] William Kuszmaul and Michael Mitzenmacher. Efficient d-ary cuckoo hashing at high load factors by bubbling up. Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 3931–3952, 2025.
[KMW10] Adam Kirsch, Michael Mitzenmacher, and Udi Wieder. More robust hashing: Cuckoo hashing with a stash. SIAM Journal on Computing, 39(4):1543–1561, 2010.
[Knu63] Donald E Knuth. Notes on “open” addressing. Unpublished memorandum, pages 11–97, 1963.
[Knu98] Donald E Knuth. The Art of Computer Programming: Volume 3: Sorting and Searching. Addison-Wesley Professional, 1998.
[Kus22] William Kuszmaul. A hash table without hash functions, and how to get the most out of your random bits. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 991–1001. IEEE, 2022.
[Kus23] William Kuszmaul. Strongly history-independent storage allocation: New upper and lower bounds. In 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pages 1822–1841. IEEE, 2023.
[Kus26] William Kuszmaul. An analysis of Brent's insertion method for hash tables. arXiv preprint arXiv:2608.00762, 2026.
[KX24] William Kuszmaul and Zoe Xi. Towards an analysis of quadratic probing. In 51st International Colloquium on Automata, Languages, and Programming (ICALP), volume 297 of LIPIcs, pages 103:1–103:19. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2024.
[LLYZ23] Tianxiao Li, Jingxun Liang, Huacheng Yu, and Renfei Zhou. Tight cell-probe lower bounds for dynamic succinct dictionaries. In 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pages 1842–1862. IEEE, 2023.
[LLYZ24] Tianxiao Li, Jingxun Liang, Huacheng Yu, and Renfei Zhou. Dynamic dictionary with subconstant wasted bits per key. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 171–207. SIAM, 2024.
[LM88] George Lueker and Mariko Molodowitch. More analysis of double hashing. In Proceedings of the twentieth annual ACM symposium on Theory of computing, pages 354–359, 1988.
[Lyo85] Gordon Lyon. Achieving hash table searches in one or two bucket probes. The Computer Journal, 28(3):313–318, 1985.
[M 89] Colin McDiarmid et al. On the method of bounded differences. Surveys in combinatorics, 141(1):148–188, 1989.
[Mau68] Ward Douglas Maurer. Programming technique: An improved hash code for scatter storage. Communications of the ACM, 11(1):35–38, 1968.
[MC86] J Ian Munro and Pedro Celis. Techniques for collision resolution in hash tables with open addressing. In Proceedings of the 1986 ACM Fall Joint Computer Conference (FJCC), pages 601–610, 1986.
[MT12] Michael Mitzenmacher and Justin Thaler. Peeling arguments and double hashing. In 2012 50th Annual Allerton Conference on Communication, Control, and Computing (Allerton), pages 1118–1125. IEEE, 2012.
[NT01] Moni Naor and Vanessa Teague. Anti-persistence: History independent data structures. In Proceedings of the thirty-third annual ACM symposium on Theory of computing, pages 492–501, 2001.
[ÖP03] Anna Östlin and Rasmus Pagh. Uniform hashing in constant time and linear space. In Lawrence L. Larmore and Michel X. Goemans, editors, Proceedings of the 35th Annual ACM Symposium on Theory of Computing (STOC 2003), June 9–11, 2003, San Diego, CA, USA, pages 622–628. ACM, 2003.
[PBC 23] Prashant Pandey, Michael A Bender, Alex Conway, Martín Farach-Colton, William Kuszmaul, Guido Tagliavini, and Rob Johnson. IcebergHT: High performance hash tables through stability and low associativity. Proceedings of the ACM on Management of Data, 1(1):1–26, 2023.
[Pet57] W Wesley Peterson. Addressing for random-access storage. IBM journal of Research and Development, 1(2):130–146, 1957.
[PP08] Anna Pagh and Rasmus Pagh. Uniform hashing in constant time and optimal space. SIAM Journal on Computing, 38(1):85–96, 2008.
[PR01] Rasmus Pagh and Flemming Friche Rodler. Cuckoo hashing. Proceedings of the 9th Annual European Symposium on Algorithms (ESA), pages 121–133, 2001.
[Rad70] Charles E Radke. The use of quadratic residue research. Communications of the ACM, 13(2):103–105, 1970.
[RR03] Rajeev Raman and Satti Srinivasa Rao. Succinct dynamic dictionaries and trees. In Automata, Languages and Programming: 30th International Colloquium (ICALP), pages 357–368. Springer Berlin Heidelberg, 2003.
[Sie89] Alan Siegel. On universal classes of fast high performance hash functions, their time-space tradeoff, and their applications (extended abstract). In 30th Annual Symposium on Foundations of Computer Science, Research Triangle Park, North Carolina, USA, 30 October - 1 November 1989, pages 20–25. IEEE Computer Society, 1989.
[Sie04] Alan Siegel. On universal classes of extremely random constant-time hash functions. SIAM Journal on Computing, 33(3):505–543, 2004.
[Tho13] Mikkel Thorup. Simple tabulation, fast expanders, double tabulation, and high independence. In 2013 IEEE 54th Annual Symposium on Foundations of Computer Science, pages 90–99. IEEE, 2013.
[TMKC26] Xilin Tang, Yuqi Mai, William Kuszmaul, and Alex Conway. Succinct and fast tiny pointer hash tables. Proceedings of the VLDB Endowment, 19(9):2168–2182, 2026.
[Wal22] Stefan Walzer. Insertion time of random walk cuckoo hashing below the peeling threshold. Proceedings of the 30th Annual European Symposium on Algorithms (ESA), 244(87):1–11, 2022.
[Wal23] Stefan Walzer. Load thresholds for cuckoo hashing with overlapping blocks. ACM Transactions on Algorithms, 19(3):1–22, 2023.
[Yao85] Andrew Chi-Chih Yao. Uniform hashing is optimal. Journal of the ACM, 32(3):687–693, 1985.
[Zam26] Or Zamir. Locality in open addressing hash tables. arXiv preprint arXiv:2607.16390, 2026.
A Proof of Theorem 7.1
In this section, we present the proof of Theorem 7.1.
Theorem 7.1 (Arbitrary capacities). There is a constant , in fact one may take , such that: For every sufficiently large , there exists a hash table construction with the same guarantees as Theorem 6.2 (or, if one wishes, Theorem 6.1), but using slots.
Proof. Let be a sufficiently large positive constant, chosen so that is a power of two, and define . The data structure will consist of sub-structures, each with capacity , and each using bin size . Each sub-structure will be implemented, as a black box, using Theorem 6.2 (or, if one wants strong history independence, Theorem 6.1). We refer to the sub-structures as blocks. Each element will hash to a random block and interact only with that block. So long as the blocks are weakly history-independent (resp. strongly history-independent), the data structure will also be weakly history-independent (resp. strongly history-independent).
The main thing to be careful about is to select the block size N to satisfy the Divisibility Assumption. Set
and define
By design, the Divisibility Assumption is satisfied, since
Each block has capacity and has slots. Moreover, so long as we can guarantee that the block never has more than live elements at a time, then Theorem 6.2 (or Theorem 6.1) guarantees -time operations with high probability in (and therefore also with high probability in ).
Next we determine how many blocks to use. We want to have enough blocks that, with high probability, each block stays below its capacity N at all times. To do this, set
The global table consists of r blocks. The number of slots used is . Since ,
The total number of slots therefore satisfies
To prove the theorem, it remains to check that, during a sequence of insertions and deletions, there is (with high probability in ) never a point in time at which some block has more than live keys at a time. Since the sequence is only of polynomial length, and since there are blocks, it suffices to consider the state of the hash table at a fixed moment in time, to consider a fixed block , and to show that, with high probability in , there are at most keys that hash to .
Let be the hash function used to map elements to blocks. For a fixed block , the number of live keys with is a sum of i.i.d. Bernoulli random variables with total mean at most . By a Chernoff bound,
Therefore, with high probability in n, there are at most N keys that hash to the block at a time. This completes the proof.
B Proof of Lemma 11.1
Lemma 11.1 (Sub-Gaussian tails and MGF bounds). Let Y be a random variable with .
- If , then for every ,
- Conversely, there is an absolute constant C > 0 such that if there exists v > 0 with
then .
Proof. Let . Then .
For the first part, assume . For every , Markov's inequality gives
Optimizing over , with , gives
Applying the same argument to , which is also in , gives
Therefore, by the union bound,
For the converse, assume that
We first derive a moment bound. For every integer ,
Changing variables , we get
Using the standard estimate for an absolute constant , this implies
for an absolute constant .
Now fix . Since ,
Using Stirling's lower bound , we have
for an absolute constant . A standard summation estimate gives
for an absolute constant . Therefore
Equivalently,
for . Hence , as claimed.
C Proof of Lemma 11.5
Lemma 11.5 (Clipping a sub-Gaussian). Let , and define
Then
Moreover, for any constant , there exists a constant , depending only on , such that if and
then
Proof. Let
The map is nondecreasing and 1-Lipschitz. We use the standard one-dimensional contraction principle: if is nondecreasing and 1-Lipschitz, then
is dominated by
in convex order. Therefore, for every convex function ,
Applying this with
for arbitrary , gives
Hence
We now prove the two additional bounds. Assume and
Then both clipping thresholds 0 and B are at distance at least B/5 from . By the sub-Gaussian tail bound,
It remains to bound the change in expectation. Since clipping changes X only when X < 0 or X > B,
For the lower tail, using the tail-integral formula,
Since , for all ,
Therefore
Using
we get
Similarly, since , the upper-tail integral yields
by the same calculation as above. Consequently,
Now choose . For all sufficiently large B,
Thus
☐
D Proof of Lemma 11.6
Lemma 11.6 (Sub-Gaussian coupling for a Poisson random variable). There exist absolute constants such that the following holds. Let with . Then there exists a random variable , coupled with , such that , , and . Moreover, may be chosen to be integer-valued.
Proof. Fix a sufficiently large absolute constant , for example , and let
By the standard Chernoff bound for Poisson random variables,
for some constant .
Define
when . Standard Poisson tail estimates imply
for an absolute constant .
First define a possibly non-integer random variable
Then
Also,
It remains to note that is sub-Gaussian with variance . Indeed, agrees with except on the event , whose probability is , and is supported on an interval of length . Furthermore, for deviations , the tails of are bounded by the corresponding Poisson Chernoff tails, up to the additional exceptional mass . Therefore
By Lemma 11.1, this implies
for an absolute constant C > 0.
Finally, to make integer-valued, replace the value on by an independent two-point random variable satisfying
Using Z instead of m preserves the identity , preserves the coupling probability, and only changes constants in the sub-Gaussian proxy.
E Proof of Lemma 11.7
Lemma 11.7 (Sub-Gaussianity under binomial thinning). Let be a nonnegative integer-valued random variable such that (in particular ), and suppose that almost surely. Conditional on , let . Then
Proof. First,
Fix . We decompose
Conditioning on G, and applying Lemma 11.4, gives
Therefore,
Since , Lemma 11.3 implies , and hence
Combining the two bounds,
Thus , as claimed.