Bounds for min-max heaps
- 89 Downloads
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 Categories4.34 5.25 5.31 5.32 8.1
Unable to display preview. Download preview PDF.
- 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).Google Scholar
- 7.A. Hasham,A new class of priority queue organizations, M.C.S. Thesis, School of Computer Science, Carleton University (1986).Google Scholar
- 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