Pairing Heaps Analysis

16
RESEARCH CONlRlWlIONS Algorithms and Data Structures Pairing Heaps: G. Scott Graham Editor Experiments and Analysis JOHN T. STASKO and JEFFREY SCOTT VlllER ABSTRACT: The pairing heap has recently been introduced as a new data structure for priority queues. Pairing heaps are extremely simple to implement and seem to be very efficient in practice , but they are difficult to anal yze theoretically, and open problems remain. It has been conjectured that they achieve the same amortized time bounds as Fibonacci heaps, namely, O(log n) time for delete and delete-min and O(1) for all other operations, where n is the size of the priority queue at the time of the operation. We provide empirical evidence that supports this conjecture. The most promising algorithm in our simulations is a new variant of the twopass method, cal led auxil iary twopass. We prove that, assumi ng no decrease-key operations are performed, it achieves the same amortized time bounds as Fibonacci heaps. 1. INTRODUCTION A priority queue is an abstract data type for main- taining and mani pulating a set of items based on priority [I]. Prio’rity queues derive great theoretical Support was provided in part by NSF research gran t DCR-84-03613, an NSF Presidential Young Investigator Award, an IBM Faculty Developm ent Award, and a Guggenheim Fellowship. Part of this research was performed at Mathematical Sciences Research Insti- tute. Berkeley, Cali f., and the Institut National de Recherche en Informatique et en Automatique, Rocquencour t. France. 0 1987 ACM OOOl-078 2/87/0300-0234 75a: and practical importance from their use in solving a wide range of combinatorial problems, including job scheduling, minimal spanning tree, shortes t path, and graph traversal. Priority queues suppo rt the operation s insert, find-min, and delete-m in; additional operation s often incl ude decrease-key and delete. The insert(t , v) opera- tion adds item t with key value v to the priorit y queue. The find-min operation returns the item wit h minimum key value. The delete-min operat ion returns the item with minimum key value and removes it from the priority queue. The decrease- key(t, d) operation reduces item t’s key value by d. The delete(t) operation removes item t from the priori ty queue. The decrease-key and delete opera- tions require that a pointer to the location in the priority queue of item t be supplied explicitly, since priori ty queues do not support searching for arbi- trary items by value. Some priori ty queues also sup- port t he merge operation, which combines two item- disjoint priority queues. We will concentrate on the insert, delete-min, and decrease-key operations because they are the opera- tions that primarily distinguish priority queues from other set manipulation algorithms and because they are the crit ical operations as far as the time bounds are concerned. Commu nications of the ACM March 1987 Volume 30 Number 3

Transcript of Pairing Heaps Analysis

Page 1: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 1/16

Page 2: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 2/16

Page 3: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 3/16

Page 4: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 4/16

Page 5: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 5/16

Page 6: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 6/16

Page 7: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 7/16

Page 8: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 8/16

Page 9: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 9/16

Page 10: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 10/16

Page 11: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 11/16

Page 12: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 12/16

Page 13: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 13/16

Page 14: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 14/16

Page 15: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 15/16

Page 16: Pairing Heaps Analysis

8/3/2019 Pairing Heaps Analysis

http://slidepdf.com/reader/full/pairing-heaps-analysis 16/16