Table of Contents
Fetching ...

Bottom-up Rebalancing Binary Search Trees by Flipping a Coin

Gerth Stølting Brodal

TL;DR

This paper considers two simple canonical randomized bottom-up insertion algorithms on binary search trees, and proves for both algorithms that there exist simple insertion sequences where the expected depth is $\Omega(n)$, i.e., the studied rebalancing schemes are not competitive with (most) other rebalancing schemes in the literature.

Abstract

Rebalancing schemes for dynamic binary search trees are numerous in the literature, where the goal is to maintain trees of low height, either in the worst-case or expected sense. In this paper we study randomized rebalancing schemes for sequences of $n$ insertions into an initially empty binary search tree, under the assumption that a tree only stores the elements and the tree structure without any additional balance information. Seidel~(2009) presented a top-down randomized insertion algorithm, where insertions take expected $O\big(\lg^2 n\big)$ time, and the resulting trees have the same distribution as inserting a uniform random permutation into a binary search tree without rebalancing. Seidel states as an open problem if a similar result can be achieved with bottom-up insertions. In this paper we fail to answer this question. We consider two simple canonical randomized bottom-up insertion algorithms on binary search trees, assuming that an insertion is given the position where to insert the next element. The subsequent rebalancing is performed bottom-up in expected $O(1)$ time, uses expected $O(1)$ random bits, performs at most two rotations, and the rotations appear with geometrically decreasing probability in the distance from the leaf. For some insertion sequences the expected depth of each node is proved to be $O(\lg n)$. On the negative side, we prove for both algorithms that there exist simple insertion sequences where the expected depth is $Ω(n)$, i.e., the studied rebalancing schemes are \emph{not} competitive with (most) other rebalancing schemes in the literature.

Bottom-up Rebalancing Binary Search Trees by Flipping a Coin

TL;DR

This paper considers two simple canonical randomized bottom-up insertion algorithms on binary search trees, and proves for both algorithms that there exist simple insertion sequences where the expected depth is , i.e., the studied rebalancing schemes are not competitive with (most) other rebalancing schemes in the literature.

Abstract

Rebalancing schemes for dynamic binary search trees are numerous in the literature, where the goal is to maintain trees of low height, either in the worst-case or expected sense. In this paper we study randomized rebalancing schemes for sequences of insertions into an initially empty binary search tree, under the assumption that a tree only stores the elements and the tree structure without any additional balance information. Seidel~(2009) presented a top-down randomized insertion algorithm, where insertions take expected time, and the resulting trees have the same distribution as inserting a uniform random permutation into a binary search tree without rebalancing. Seidel states as an open problem if a similar result can be achieved with bottom-up insertions. In this paper we fail to answer this question. We consider two simple canonical randomized bottom-up insertion algorithms on binary search trees, assuming that an insertion is given the position where to insert the next element. The subsequent rebalancing is performed bottom-up in expected time, uses expected random bits, performs at most two rotations, and the rotations appear with geometrically decreasing probability in the distance from the leaf. For some insertion sequences the expected depth of each node is proved to be . On the negative side, we prove for both algorithms that there exist simple insertion sequences where the expected depth is , i.e., the studied rebalancing schemes are \emph{not} competitive with (most) other rebalancing schemes in the literature.
Paper Structure (18 sections, 19 theorems, 4 equations, 15 figures, 2 tables, 2 algorithms)

This paper contains 18 sections, 19 theorems, 4 equations, 15 figures, 2 tables, 2 algorithms.

Key Result

Theorem 1

Executing Rebalance-Zig with $0<p<1$ on an increasing and decreasing sequence of $n$ insertions results in a binary search tree, where each node has expected depth $O(\lg n)$.

Figures (15)

  • Figure 1: Unbalanced binary search trees resulting from inserting permutations of $\{1,\ldots,6\}$. The insertion order is shown below the trees. The types of permutations are defined in Table \ref{['tab:sequences']}.
  • Figure 2: The unbalanced binary search trees resulting from inserting (without rebalancing) random permutations of the sequence 1, 2, 3. Below each tree is the probability of the tree and the permutations resulting in the tree.
  • Figure 3: (Left-to-right) The right rotation of $u$ rotates $v$ up; note that $a$ is moved one level up in the tree, $b$ remains at the same level, and $c$ is moved down one level. (Right-to-left) the left rotation of $v$ rotates $u$ up.
  • Figure 4: Rebalance-Zig with $p=0$ always rotates up the inserted node, and maintains the invariant that the tree is a single path. (left) insertion point of 7; (right) 7 is rotated up onto the path.
  • Figure 5: Binary search trees resulting from inserting the sequence 1, 3, 2 using Rebalance-Zig. Each of the four search trees has probability 1/4 when $p=1/2$ (see Figure \ref{['fig:insertion-cases']} for detailed cases) . Note that the perfect balanced binary search tree on three nodes cannot by achieved Rebalance-Zig on this insertion sequence.
  • ...and 10 more figures

Theorems & Definitions (20)

  • Theorem 1
  • Theorem 2
  • Theorem 3
  • Theorem 4
  • Theorem 5
  • Theorem 6
  • Lemma 7
  • Lemma 8
  • Lemma 9
  • Lemma 10
  • ...and 10 more