Abstract
It is possible to improve the worst-case behavior of operations on heaps, when counting number of comparisons between elements in the heap, by modifying the traditional binary heap. The improvement suggested is the use of a heap with “scattered” leaves. This method can be combined with the use of a ternary heap for even greater improvement.
Some other improvements of worst-case behavior compared to standard algorithms are discussed at the end of the paper, where the gain of at least (N-2) comparisons when sortingN elements with HEAPSORT is of great interest in implementations. An algorithm for inserting a new element in a heap inO(log logn) comparisons between elements is mentioned.
Similar content being viewed by others
References
S. Carlsson,Improving worst-case behavior of heaps, Report LUNFD6/(NFCS-3004)/(1–21)/(1983), Department of Computer Science, Lund University, (1983).
H. Erkiö,On heapsort and its dependence on input data, Report A-1979-1, Department of Computer Science, University of Helsinki, (1979).
F. Göbel and C. Hoede,On an optimality property of ternary trees, Inform. Contr. 42 (1979), 10–26.
D. E. Knuth,The Art of Computer Programming, Vol. 3:Sorting and Searching (2nd printing). Addison-Wesley, (1975).
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Carlsson, S. Improving worst-case behavior of heaps. BIT 24, 14–18 (1984). https://doi.org/10.1007/BF01934511
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF01934511