We introduce the zip tree, 1 a form of randomized binary search tree. One can view a zip tree as a treap [8] in which priority ties are allowed and in which insertions and deletions are done by unmerging and merging paths (unzipping and zipping) rather than by doing rotations. Alternatively, one can view a zip tree as a binary-tree representation of a skip list [7]. Doing insertions and deletions by unzipping and zipping instead of by doing rotations avoids some pointer changes and can thereby improve efficiency. Representing a skip list as a binary tree avoids the need for nodes of different sizes and can speed up searches and updates. Zip trees are at least as simple as treaps and skip lists but offer improved efficiency. Their simplicity makes them especially amenable to concurrent operations. Definition of Zip TreesA binary search tree is a binary tree in which each node contains an item, each item has a key, and the items are arranged in symmetric order : if x is a node, all items in the left subtree of x have keys less than that of x, and all items in the right subtree of x have keys greater than that of x. Such a tree supports binary search: to find an item in the tree with a given key, proceed as follows. If the tree is empty, stop: no item in the tree has the given key. Otherwise, compare the desired key with that of the item in the root. If they are equal, stop and return the item in the root. If the given key is less than that of the item in the root, search recursively in the left subtree of the root. Otherwise, search recursively in the right subtree of the root. The path of nodes visited during the search is the search path. If the search is unsuccessful, the search path starts at the root and ends at a missing node corresponding to an empty subtree.
We introduce the zip tree , 1 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 [8], 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 by Stephenson [10], Martínez and Roura [5], and Sprugnoli [9]. 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 [7], and simplify Dean and Jones’ mapping between skip lists
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
customersupport@researchsolutions.com
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.