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 $n$-node zip-zip tree is at most $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(\log\log n)$ bits of metadata per node, w.h.p., as compared to the $\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)$ 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, $k$, with weight, $w_k$, is $O(\log (W/w_k))$, where $W$ 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)$ space overhead w.h.p.
翻译:我们定义了Zip树的简单变体,称为Zip-zip树,它们相比Zip树具有若干优势,包括克服了对较小键优于较大键的偏向性。我们从理论和实证两方面分析了Zip-zip树,例如表明:在包含$n$个节点的Zip-zip树中,节点的期望深度至多为 $1.3863\log n-1+o(1)$,这与通过均匀随机插入构建的treap和二叉搜索树的期望深度一致。然而,与其他数据结构不同,Zip-zip树仅需每个节点$O(\log\log n)$比特的元数据(高概率)即可达到其界限,而treap需要每个节点$\Theta(\log n)$比特。事实上,我们还描述了一种“即时”Zip-zip树变体,其每个节点仅需期望的$O(1)$比特元数据。此外,我们可以将Zip-zip树定义为强历史无关的,而treap通常仅是弱历史无关的。我们还引入了“有偏Zip-zip树”,其基于键权重具有显式偏向性,因此权重为$w_k$的键$k$的期望深度为$O(\log (W/w_k))$,其中$W$是加权Zip-zip树中所有键的总权重。最后,我们表明可以轻松使Zip-zip树实现部分持久化,且高概率下仅需$O(n)$的额外空间开销。