Acta Informatica

, Volume 22, Issue 2, pp 171–186

An algorithm for merging meaps

  • Jörg -R. Sack
  • Thomas Strothotte

DOI: 10.1007/BF00264229

Cite this article as:
Sack, J.R. & Strothotte, T. Acta Informatica (1985) 22: 171. doi:10.1007/BF00264229


We 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).

Copyright information

© Springer-Verlag 1985

Authors and Affiliations

  • Jörg -R. Sack
    • 1
  • Thomas Strothotte
    • 2
  1. 1.School of Computer ScienceCarleton UniversityOttawaCanada
  2. 2.INRIA RocquencourtLe ChesnayFrance

Personalised recommendations