Abstract
In this paper a well-known algorithm is studied which accomplishes the insertion of a new element into a heap. Under the assumption of uniformly distributed heaps and new elements, respectively, an explicit expression for the expected number of comparisons in terms of the binary representation of the number of elements in the heap is derived. From this, higher moments are calculated and asymptotically evaluated. Some numerical evidence is given that the mathematically derived results agree with results obtained in a simulation.
Similar content being viewed by others
References
Aho, A. V., Hopcroft, J. E., Ullman, J. D.:The Design and Analysis of Algorithms. Addison-Wesley, Reading, Mass., 1974.
Bender, E. A.:Asymptotic methods in enumeration. SIAM Review 16 (1974), 485–515.
Bromwich, T. J. I'A:An Introduction to the Theory of Infinite Series. Macmillan, London, 1926 (Second Edition).
Darboux, G.: Mémoire sur l'approximation des fonctions des trés grand nombres, J. de Mathématiques (3) 6 (1878), 1–56, 377–416.
Doberkat, E.-E.:Some observations on the average behavior of heapsort—preliminary report. 21st IEEE FOCS, Syracuse, N.Y., (1980), 229–237.
Doberkat, E.-E.:Inserting a new element into a heap. Informatik-Berichte 5, Fernuniversität Hagen, 1980.
Feller, W.:Introduction to Probability Theory and its Applications, vol. I. John Wiley and Sons, New York, 1968 (Third Edition).
Habermann, A. N.:Introduction to Operating System Design. Science Research Associates, Chicago, 1976.
Hansen, E. R.:A Table of Series and Products. Prentice-Hall, Englewood Cliffs, N.J., 1975.
Knuth, D. E.:The Art of Computer Programming, vol. I—Fundamental Algorithms. Addison-Wesley, Reading, Mass., 1973 (Second Edition).
Knuth, D. E.:The Art of Computer Programming. vol. III—Sorting and Searching. Addison-Wesley, Reading, Mass., 1973.
Porter, Th. Simon, I.:Random insertion into a priority queue structure. IEEE Trans. Software Engineering, SE-1 (1975), 292–298.
Rudin, W.:Real and Complex Analysis. Tata McGraw Hill, New Delhi, 1974 (Second Edition).
Whittaker, E.T., Watson, G. N.:A Course of Modern Analysis. Cambridge University Press, 1927 (Fourth Edition).
Williams, J. W. J.:Algorithm 232:Heapsort. Comm. ACM 7 (1964), 347–348.
Author information
Authors and Affiliations
Additional information
Some results of this paper have been presented at the 1981 Conference on Information Sciences and Systems, Johns Hopkins University, Baltimore.
Sponsored in part by the Institute of Educational Informatics, Forschungs- und Entwicklungszentrum für objektivierte Lehr- und Lernverfahren, Paderborn.
(on leave to the Dept. of Mathematics and Computer Science, Clarkson College of Technology, Potsdam, N.Y. 13676, U.S.A.)
Rights and permissions
About this article
Cite this article
Doberkat, EE. Inserting a new element into a heap. BIT 21, 255–269 (1981). https://doi.org/10.1007/BF01941462
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF01941462