Advertisement

BIT Numerical Mathematics

, Volume 27, Issue 3, pp 315–323 | Cite as

Bounds for min-max heaps

  • A. Hasham
  • J. -R. Sack
Part I Computer Science

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.

CR Categories

4.34 5.25 5.31 5.32 8.1 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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. 2.
    M. D. Atkinson,Mathematics in the service of computer programming, Mathematical Spectrum 10: 1, 6–11 (1977/78).Google Scholar
  3. 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. 4.
    S. Carlsson,Heaps, Ph.D. Dissertation, Lund University, Lund, Sweden (November 1986).Google Scholar
  5. 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. 6.
    G. H. Gonnett and J. I. Munro,Heaps on heaps, Proc. ICALP 9, Aarhus, 282–291 (July 1982).Google Scholar
  7. 7.
    A. Hasham,A new class of priority queue organizations, M.C.S. Thesis, School of Computer Science, Carleton University (1986).Google Scholar
  8. 8.
    D. E. Knuth,The Art of Computer Programming, Vol. 3: Sorting and Searching, Addison-Wesley, Reading, Mass (1973).Google Scholar
  9. 9.
    J.-R. Sack and Th. Strothotte,An algorithm for merging heaps, Acta Informatica 22, 171–186 (1985)Google Scholar
  10. 10.
    Th. Strothotte and J.-R. Sack,Heaps in heaps, Congressus Numerantium 49, 223–235 (December 1985).Google Scholar
  11. 11.
    J. W. J. Williams,Algorithm 232: Heapsort, Comm. ACM 7: 6, 347–348 (June 1964).Google Scholar

Copyright information

© BIT Foundations 1987

Authors and Affiliations

  • A. Hasham
    • 1
  • J. -R. Sack
    • 1
  1. 1.School of Computer ScienceCarleton UniversityOttawaCanada

Personalised recommendations