We introduce the zip tree, a form of randomized binary search tree that integrates previous ideas into one practical, performant, and pleasant-to-implement package. A zip tree is a binary search tree in which each node has a numeric rank and the tree is (max)-heap-ordered with respect to ranks, with rank ties broken in favor of smaller keys. Zip trees are essentially treaps (Seidel and Aragon 1996), except that ranks are drawn from a geometric distribution instead of a uniform distribution, and we allow rank ties. These changes enable us to use fewer random bits per node. We perform insertions and deletions by unmerging and merging paths ("unzipping" and "zipping") rather than by doing rotations, which avoids some pointer changes and improves efficiency. The methods of zipping and unzipping take inspiration from previous top-down approaches to insertion and deletion (Stephenson 1980; Mart\'inez and Roura 1998; Sprugnoli 1980). From a theoretical standpoint, this work provides two main results. First, zip trees require only $O(\log \log n)$ bits (with high probability) to represent the largest rank in an $n$-node binary search tree; previous data structures require $O(\log n)$ bits for the largest rank. Second, zip trees are naturally isomorphic to skip lists (Pugh 1990), and simplify the mapping of (Dean and Jones 2007) between skip lists and binary search trees.
翻译:我们引入了拉链树, 这是一种随机化的二进制搜索树, 将先前的想法整合成一个实用的、 性能的和舒适的套件。 拉链树是一个二进制的搜索树, 每个节点都有数字级, 树是( max) 排成( max) 排成( max) 排成( max) 排成) 。 Zip 树基本上是树的图案( Seidel 和 Aragon 1996 ), 但从几何分布而不是统一分布中抽取, 我们允许排序关系。 这些变化可以让我们使用更少随机的每个节点的比特点。 我们通过不合并和合并路径( “ unzipping” 和“ zipping” ) 来进行插入和删除, 而不是通过旋转, 避免某些指向变化, 提高效率。 zip 和 平整方法从上到插入和删除( Stephenson 1980 ; Mart\' 和 Roura 1998 ) 之间, 我们从理论角度的角度, 这个工作提供了两次插入和删除的图案底图图图图, 。 最高级图图图图案需要一个前一至 美元, 最高级图案号, 。