English

Zip-zip Trees: Making Zip Trees More Balanced, Biased, Compact, or Persistent

Data Structures and Algorithms 2025-02-11 v2

Abstract

We define simple variants of zip trees, called zip-zip trees, which provide several advantages over zip trees, including overcoming a bias that favors smaller keys over larger ones. We analyze zip-zip trees theoretically and empirically, showing, e.g., that the expected depth of a node in an nn-node zip-zip tree is at most 1.3863logn1+o(1)1.3863\log n-1+o(1), which matches the expected depth of treaps and binary search trees built by uniformly random insertions. Unlike these other data structures, however, zip-zip trees achieve their bounds using only O(loglogn)O(\log\log n) bits of metadata per node, w.h.p., as compared to the Θ(logn)\Theta(\log n) bits per node required by treaps. In fact, we even describe a ``just-in-time'' zip-zip tree variant, which needs just an expected O(1)O(1) number of bits of metadata per node. Moreover, we can define zip-zip trees to be strongly history independent, whereas treaps are generally only weakly history independent. We also introduce \emph{biased zip-zip trees}, which have an explicit bias based on key weights, so the expected depth of a key, kk, with weight, wkw_k, is O(log(W/wk))O(\log (W/w_k)), where WW is the weight of all keys in the weighted zip-zip tree. Finally, we show that one can easily make zip-zip trees partially persistent with only O(n)O(n) space overhead w.h.p.

Keywords

Cite

@article{arxiv.2307.07660,
  title  = {Zip-zip Trees: Making Zip Trees More Balanced, Biased, Compact, or Persistent},
  author = {Ofek Gila and Michael T. Goodrich and Robert E. Tarjan},
  journal= {arXiv preprint arXiv:2307.07660},
  year   = {2025}
}

Comments

v2 to appear in the journal Algorithmica, 24 pages, 9 figures

R2 v1 2026-06-28T11:30:59.801Z