Table of Contents
Fetching ...

Amortized Analysis of Leftist Heaps

Berry Schoenmakers

TL;DR

The amortized complexity of leftist heaps is analyzed to initiate a full performance comparison with skew heaps, and it is shown how weight-biased leftist heaps satisfy the same exact amortized bounds as skew heaps.

Abstract

Leftist heaps and skew heaps are two well-known data structures for mergeable priority queues. Leftist heaps are constructed for efficiency in the worst-case sense whereas skew heaps are self-adjusting, designed for efficiency in the amortized sense. In this paper, we analyze the amortized complexity of leftist heaps to initiate a full performance comparison with skew heaps. We consider both the leftist heaps originally developed by Crane and Knuth, which are also referred to as rank-biased (or, height-biased) leftist heaps, and the weight-biased leftist heaps introduced by Cho and Sahni. We show how weight-biased leftist heaps satisfy the same exact amortized bounds as skew heaps. With these matching bounds we establish a nice trade-off in which storage of weights is used to limit the worst-case complexity of leftist heaps, without affecting the amortized complexity compared to skew heaps. For rank-biased leftist heaps, we obtain the same amortized lower bounds as for skew heaps, but whether these bounds are tight is left as an open problem.

Amortized Analysis of Leftist Heaps

TL;DR

The amortized complexity of leftist heaps is analyzed to initiate a full performance comparison with skew heaps, and it is shown how weight-biased leftist heaps satisfy the same exact amortized bounds as skew heaps.

Abstract

Leftist heaps and skew heaps are two well-known data structures for mergeable priority queues. Leftist heaps are constructed for efficiency in the worst-case sense whereas skew heaps are self-adjusting, designed for efficiency in the amortized sense. In this paper, we analyze the amortized complexity of leftist heaps to initiate a full performance comparison with skew heaps. We consider both the leftist heaps originally developed by Crane and Knuth, which are also referred to as rank-biased (or, height-biased) leftist heaps, and the weight-biased leftist heaps introduced by Cho and Sahni. We show how weight-biased leftist heaps satisfy the same exact amortized bounds as skew heaps. With these matching bounds we establish a nice trade-off in which storage of weights is used to limit the worst-case complexity of leftist heaps, without affecting the amortized complexity compared to skew heaps. For rank-biased leftist heaps, we obtain the same amortized lower bounds as for skew heaps, but whether these bounds are tight is left as an open problem.

Paper Structure

This paper contains 9 sections, 5 theorems, 30 equations, 3 figures.

Key Result

theorem 1

There exists a potential function such that the amortized costs for weight-biased leftist heaps satisfy (counting comparisons): empty, $( {\sf isempty} \: x$, ${\sf single} \: a )$, and $( {\sf min} \: x$ cost 0, $\hbox{$( {\sf meld} \: x$} \: y )$ costs at most $\log_\phi (\hbox{$\mid\!\! x\!\!\mi

Figures (3)

  • Figure 1: Purely functional binary heaps with three balancing strategies.
  • Figure 2: _n $G_{n}$ trees for $n=0,\ldots,13$Sch97tight.
  • Figure 3: Operation $G{8}$G_8$\raisebox{-.3mm}{$\,\Join\,$}G{5}$G_5$$, viewed as first merging the rightmost paths and then swapping the subtrees of all nodes on the rightmost path, resulting in _13 $G_{13}$Sch97tight.

Theorems & Definitions (7)

  • theorem 1
  • lemma 1
  • theorem 2
  • lemma 2
  • proof
  • theorem 3
  • proof