An algorithm for merging meaps

SummaryWe present an algorithm to merge priority queues organized as heaps. The worst case number of comparisons required to merge two heaps of sizes k and n is O(log(n)*log(k)). The algorithm requires O(k) +log(n)*log (k)) data movements if heaps are implemented using arrays and O(log(n)*log(k)) for a pointer-based implementation. Previous algorithms require either O(n+k) data movements and comparisons, or O(k*log(log(n+k))) comparisons and O(k*log(n+k)) data movements. The algorithm presented in this paper improves on the previous algorithms for the case when k>log(n).

[1]  David Thomas,et al.  The Art in Computer Programming , 2001 .

[2]  Alfred V. Aho,et al.  The Design and Analysis of Computer Algorithms , 1974 .

[3]  Jean Vuillemin,et al.  Description and analysis of an efficient priority queue representation , 1978, 19th Annual Symposium on Foundations of Computer Science (sfcs 1978).

[4]  Donald E. Knuth,et al.  The Art of Computer Programming, Vol. 3: Sorting and Searching , 1974 .

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

[6]  John Beidler,et al.  Data Structures and Algorithms , 1996, Wiley Encyclopedia of Computer Science and Engineering.

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

[8]  Gaston H. Gonnet,et al.  Handbook Of Algorithms And Data Structures , 1984 .

[9]  Mark R. Brown The Analysis of a Practical and Nearly Optimal Priorty Queue , 1977, Outstanding Dissertations in the Computer Sciences.

[10]  Gaston H. Gonnet,et al.  Heaps on Heaps , 1982, SIAM J. Comput..