Lune

FOCS2021Top-tier venue

Linear Probing Revisited: Tombstones Mark the Demise of Primary Clustering

Michael A. Bender, Bradley C. Kuszmaul, William Kuszmaul

2021Year
11Citations
6Top-tier citations

Abstract

The linear-probing hash table is one of the oldest and most widely used data structures in computer science. However, linear probing famously comes with a major draw-back: as soon as the hash table reaches a high memory utilization, elements within the hash table begin to cluster together, causing insertions to become slow. This phenomenon, now known as primary clustering, was first captured by Donald Knuth in 1963; at a load factor of1−1/x1 -1/x, the expected time per insertion isΘ(x2)\Theta(x^{2}), rather than the more desirableΘ(x)\Theta(x). We show that there is more to the story than the classic analysis would seem to suggest. It turns out that small design decisions in how deletions are implemented have dramatic effects on the asymptotic performance of insertions. If these design decisions are made correctly, then even a hash table that is continuously at a load factor1−Θ(1/x)1-\Theta(1/x)can achieve average insertion timeO~(x)\tilde{O}(x). A key insight is that the tombstones left behind by deletions cause a surprisingly strong “anti-clustering” effect, and that when insertions and deletions are one-for-one, the anti-clustering effects of deletions actually overpower the clustering effects of insertions. We also present a new variant of linear probing, which we call graveyard hashing, that completely eliminates primary clustering on any sequence of operations. If, when an operation is performed, the current load factor is1−1/x1 -1/xfor somexx, then the expected cost of the operation isO(x)O(x). One corollary is that, in the external-memory model with a data block size ofBB, graveyard hashing offers the following remarkable guarantee: at any load factor1−1/x1 -1/xsatisfyingx=o(B)x=o(B), graveyard hashing achieves1+o(1)1 +o(1)expected block transfers per operation. Past external-memory hash tables have only been able to offer a1+o(1)1 +o(1)guarantee when the block sizeBBis at leastΩ(x2)\Omega(x^{2}). Our results come with actionable lessons for both theoreticians and practitioners, in particular, that well-designed use of tombstones can completely change the asymptotic landscape of how the linear probing behaves (and if there are no deletions).

Ask about this paper

Ask your agent about it.

Lune has read the top-tier papers around this one, so every answer names the papers it rests on.

Questions to start from

Your agent calls

Lunesearch_papers

Ask in Lune

Free to start. No credit card required.

lune papers get d772feff-e9f0-4775-a76d-fee960628683

Cited by top-tier papers6

Ask how each one uses it

Related papers

Dusk over the sea between two cliffs drawn in fine vertical lines