Melding priority queues

We show that any priority queue data structure that supports <i>insert</i>, <i>delete</i>, and <i>find-min</i> operations in <i>pq</i>(<i>n</i>) amortized time, where <i>n</i> is an upper bound on the number of elements in the priority queue, can be converted into a priority queue data structure that also supports fast <i>meld</i> operations with essentially no increase in the amortized cost of the other operations. More specifically, the new data structure supports <i>insert</i>, <i>meld</i> and <i>find-min</i> operations in <i>O</i>(1) amortized time, and <i>delete</i> operations in <i>O</i>(<i>pq</i>(<i>n</i>) + α(<i>n</i>)) amortized time, where α(<i>n</i>) is a functional inverse of the Ackermann function, and where <i>n</i> this time is the total number of operations performed on all the priority queues. The construction is very simple. The meldable priority queues are obtained by placing a nonmeldable priority queues at each node of a union-find data structure. We also show that when all keys are integers in the range [1, <i>N</i>], we can replace <i>n</i> in the bound stated previously by min{<i>n</i>, <i>N</i>}.Applying this result to the nonmeldable priority queue data structures obtained recently by Thorup [2002b] and by Han and Thorup [2002] we obtain meldable RAM priority queues with <i>O</i>(log log <i>n</i>) amortized time per operation, or <i>O</i>(&sqrt;log log <i>n</i>) expected amortized time per operation, respectively. As a by-product, we obtain improved algorithms for the minimum directed spanning tree problem on graphs with integer edge weights, namely, a deterministic <i>O</i>(<i>m</i> log log <i>n</i>)-time algorithm and a randomized <i>O</i>(<i>m</i>&sqrt;log log <i>n</i>)-time algorithm. For sparse enough graphs, these bounds improve on the <i>O</i>(<i>m</i> + <i>n</i> log <i>n</i>) running time of an algorithm by Gabow et al. [1986] that works for arbitrary edge weights.

[1]  Robert E. Tarjan,et al.  Efficient algorithms for finding minimum spanning trees in undirected and directed graphs , 1986, Comb..

[2]  Kurt Mehlhorn,et al.  Bounded Ordered Dictionaries in O(log log N) Time and O(n) Space , 1990, Information Processing Letters.

[3]  Peter van Emde Boas,et al.  Preserving Order in a Forest in Less Than Logarithmic Time and Linear Space , 1977, Inf. Process. Lett..

[4]  M. Thorup,et al.  Integer Sorting in Expected Time and Linear Space , 2002 .

[5]  Francesco Maffioli,et al.  A note on finding optimum branchings , 1979, Networks.

[6]  Yijie Han,et al.  Integer sorting in O(n/spl radic/(log log n)) expected time and linear space , 2002, The 43rd Annual IEEE Symposium on Foundations of Computer Science, 2002. Proceedings..

[7]  Mikkel Thorup Equivalence between priority queues and sorting , 2007, JACM.

[8]  Haim Kaplan,et al.  Meldable heaps and boolean union-find , 2002, STOC '02.

[9]  Jonathan D. Bright Range-Restricted Mergeable Priority Queues , 1993, Inf. Process. Lett..

[10]  Philip N. Klein,et al.  A randomized linear-time algorithm to find minimum spanning trees , 1995, JACM.

[11]  Robert E. Tarjan,et al.  Fibonacci heaps and their uses in improved network optimization algorithms , 1984, JACM.

[12]  Mikkel Thorup,et al.  On RAM priority queues , 1996, SODA '96.

[13]  Robert E. Tarjan,et al.  Data structures and network algorithms , 1983, CBMS-NSF regional conference series in applied mathematics.

[14]  Peter van Emde Boas,et al.  Design and implementation of an efficient priority queue , 1976, Mathematical systems theory.

[15]  Fritz Bock An algorithm to construct a minimum directed spanning tree in a directed network , 1971 .

[16]  Jan van Leeuwen,et al.  Worst-case Analysis of Set Union Algorithms , 1984, JACM.

[17]  Jean Vuillemin,et al.  A data structure for manipulating priority queues , 1978, CACM.

[18]  Inge Li Gørtz,et al.  Union-Find with Constant Time Deletions , 2005, ICALP.

[19]  Haim Kaplan,et al.  Union-find with deletions , 2002, SODA '02.

[20]  R. Prim Shortest connection networks and some generalizations , 1957 .

[21]  Clifford Stein,et al.  Introduction to Algorithms, 2nd edition. , 2001 .

[22]  Yijie Han,et al.  Deterministic sorting inO(nlog logn) time and linear space , 2002, STOC 2002.

[23]  R. K. Shyamasundar,et al.  Introduction to algorithms , 1996 .

[24]  Mikkel Thorup Randomized sorting in O(n log log n) time and linear space using addition, shift, and bit-wise boolean operations , 1997, SODA '97.

[25]  Mikkel Thorup Integer priority queues with decrease key in constant time and the single source shortest paths problem , 2004, J. Comput. Syst. Sci..

[26]  Yijie Han Deterministic sorting in O(nlog log n) time and linear space , 2002, STOC '02.

[27]  Mikkel Thorup,et al.  Black box for constant-time insertion in priority queues (note) , 2005, TALG.

[28]  Richard M. Karp,et al.  A simple derivation of Edmonds' algorithm for optimum branchings , 1971, Networks.

[29]  Michael L. Fredman,et al.  Surpassing the Information Theoretic Bound with Fusion Trees , 1993, J. Comput. Syst. Sci..

[30]  Robert E. Tarjan,et al.  Efficiency of a Good But Not Linear Set Union Algorithm , 1972, JACM.

[31]  Mikkel Thorup,et al.  On AC0 implementations of fusion trees and atomic heaps , 2003, SODA '03.

[32]  Seth Pettie,et al.  An optimal minimum spanning tree algorithm , 2000, JACM.

[33]  Gerth Stølting Brodal,et al.  Worst-case efficient priority queues , 1996, SODA '96.

[34]  Mikkel Thorup,et al.  Meldable RAM priority queues and minimum directed spanning trees , 2004, SODA '04.

[35]  Robert E. Tarjan,et al.  Finding optimum branchings , 1977, Networks.

[36]  Mikkel Thorup,et al.  Melding Priority Queues , 2004, SWAT.

[37]  Bernard Chazelle,et al.  A minimum spanning tree algorithm with inverse-Ackermann type complexity , 2000, JACM.

[38]  Michael L. Fredman,et al.  Trans-Dichotomous Algorithms for Minimum Spanning Trees and Shortest Paths , 1994, J. Comput. Syst. Sci..

[39]  Stephen Alstrup,et al.  Marked Ancestor Problems , 1998 .

[40]  Edsger W. Dijkstra,et al.  A note on two problems in connexion with graphs , 1959, Numerische Mathematik.

[41]  R. Tarjan Amortized Computational Complexity , 1985 .