Skip to main content
Log in

Bounds for min-max heaps

  • Part I Computer Science
  • Published:
BIT Numerical Mathematics Aims and scope Submit manuscript

Abstract

Very recently a new data structure, called a min-max heap, was presented for implementing the double-ended priority queue. A min-max heap onn keys is constructed inO(n) time; the minimum and maximum keys are found in constant time, and the operations of deleting the minimum, deleting the maximum and inserting a new key into the heap are performed inO(logn) time. In addition, the data structure can be stored implicitly, i.e. in an array ofn elements without using any additional pointers.

In this paper, we present lower bound results on the number of comparisons required, in the worst case, for the operations i) to construct a min-max heap on a given set of keys; ii) to convert a min-max heap into a max-min heap; and iii) to merge two min-max heaps into one min-max heap. New upper bounds for the convert and merge operations are also derived. It is found that the main difference between traditional heaps and min-max heaps lies in the time needed to perform the merge operation. While traditional heaps can be merged efficiently, it is shown that min-max heaps are not sublinearly mergeable. Even the seemingly simple task of converting a min-max heap into a max-min heap cannot be performed in less than linear time.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. A. V. Aho, J. E. Hopcroft and J. D. Ullman,The Design and Analysis of Computer Algorithms, Addison-Wesley, Reading, Mass. (1974).

    Google Scholar 

  2. M. D. Atkinson,Mathematics in the service of computer programming, Mathematical Spectrum 10: 1, 6–11 (1977/78).

    Google Scholar 

  3. M. D. Atkinson, J.-R. Sack, N. Santoro ad Th. Strothotte,Min-max heaps and generalized priority queues, Comm. ACM 29: 10, 996–1000 (October 1986).

    Google Scholar 

  4. S. Carlsson,Heaps, Ph.D. Dissertation, Lund University, Lund, Sweden (November 1986).

    Google Scholar 

  5. F. Fussenegger and H. Gabow,A counting approach to lower bounds for selection problems, Comm. ACM 7: 6, 347–348 (June 1964).

    Google Scholar 

  6. G. H. Gonnett and J. I. Munro,Heaps on heaps, Proc. ICALP 9, Aarhus, 282–291 (July 1982).

  7. A. Hasham,A new class of priority queue organizations, M.C.S. Thesis, School of Computer Science, Carleton University (1986).

  8. D. E. Knuth,The Art of Computer Programming, Vol. 3: Sorting and Searching, Addison-Wesley, Reading, Mass (1973).

    Google Scholar 

  9. J.-R. Sack and Th. Strothotte,An algorithm for merging heaps, Acta Informatica 22, 171–186 (1985)

    Google Scholar 

  10. Th. Strothotte and J.-R. Sack,Heaps in heaps, Congressus Numerantium 49, 223–235 (December 1985).

    Google Scholar 

  11. J. W. J. Williams,Algorithm 232: Heapsort, Comm. ACM 7: 6, 347–348 (June 1964).

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

This research was supported by the Natural Science and Engineering Council of Canada under Grant No. A0392. (A preliminary version of this paper was presented at the 24th Annual Allerton Conference on Communication, Control and Computing.)

Rights and permissions

Reprints and permissions

About this article

Cite this article

Hasham, A., Sack, J.R. Bounds for min-max heaps. BIT 27, 315–323 (1987). https://doi.org/10.1007/BF01933726

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01933726

CR Categories

Navigation