On the Number of Heaps and the Cost of Heap Construction

  • Hwang Hsien-Kuei
  • Steyaert Jean-Marc
Conference paper
Part of the Trends in Mathematics book series (TM)


Heaps constitute a well-known data structure allowing the implementation of an efficient O(n log n) sorting algorithm as well as the design of fast priority queues. Although heaps have been known for long, their combinatorial properties are still partially worked out: exact summation formulae have been stated, but most of the asymptotic behaviors are still unknown. In this paper, we present a number of general (not restricting to special subsequences) asymptotic results that give insight on the difficulties encountered in the asymptotic study of the number of heaps of a given size and of the cost of heap construction. In particular, we exhibit the influence of arithmetic functions in the apparently chaotic behavior of these quantities and study their extremal and average properties. It is also shown that the distribution function of the cost of heap construction using Floyd’s algorithm and other variants is asymptotically normal.


Asymptotic Normality Priority Queue Average Order Sorting Algorithm Probability Generate Function 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [2]
    B. Bollabás and I. Simon, Repeated random insertion into a priority queue structure Journal of Algorithms 6 (1985) 466–477.MathSciNetCrossRefGoogle Scholar
  2. [3]
    S. Carlsson, Average-case results on heapsort BIT 27 (1987) 2–17.MathSciNetzbMATHCrossRefGoogle Scholar
  3. [4]
    W.-M. Chen, H.-K. Hwang and G.-H. Chen, The cost distribution of queuemergesort, optimal mergesorts, and power-of-two rules Journal of Algorithms 30 (1999), 423–448.MathSciNetzbMATHCrossRefGoogle Scholar
  4. [5]
    E. E. Doberkat, An average case analysis of Floyd’s algorithm to construct heaps Information and Control 61 (1984) 114–131.Google Scholar
  5. [6]
    P. Flajolet and M. Golin, Mellin transforms and asymptotics: the mergesort recurrence Acta Informatica 31 (1994) 673–696.MathSciNetzbMATHCrossRefGoogle Scholar
  6. [7]
    R. W. Floyd, Algorithm 245, tree 3 Communications of the ACM 7 (1964) 701.CrossRefGoogle Scholar
  7. [8]
    A. Frieze, On the random construction of heaps Information Processing Letters 27 (1988) 103–109.MathSciNetzbMATHCrossRefGoogle Scholar
  8. [9]
    G. H. Gonnet and J. I. Munro, Heaps on heaps SIAM Journal on Computing 15 (1986) 964–971.MathSciNetzbMATHCrossRefGoogle Scholar
  9. [10]
    J. M. Hammersley and G. R. Grimmett, Maximal solutions of the generalised subadditive inequality, in Chapter 4 of “Stochastic Geometry” Ed. by E. F. Harding and D. G. Kendall, John Wiley and Sons, 1974.Google Scholar
  10. [11]
    J. Haigh, A neat way to prove asymptotic normality Biometrika 58 (1971) 677–678.MathSciNetzbMATHCrossRefGoogle Scholar
  11. [12]
    R. Hayward and C. McDiarmid, Average case analysis of heap building by repeated insertion Journal of Algorithms 12 (1991) 126–153.MathSciNetzbMATHCrossRefGoogle Scholar
  12. [13]
    H.-K. Hwang, On the solutions of some divide-and-conquer recurrences, Rapport de Recherche, LIX/RR/93/01, Ecole Polytechnique, 1993.Google Scholar
  13. [14]
    H.-K. Hwang, On convergence rates in the central limit theorems for combinatorial structures European Journal of Combinatorics 19 (1998) 329–343.MathSciNetzbMATHCrossRefGoogle Scholar
  14. [15]
    H.-K. Hwang, Asymptotic expansions of the mergesort recurrences Acta Informatica 35 (1998), 911–919.MathSciNetCrossRefGoogle Scholar
  15. [16]
    H.-K. Hwang, Limit theorems for mergesort Random Structures Algorithms 8 (1996), 319–336.MathSciNetzbMATHCrossRefGoogle Scholar
  16. [17]
    H.-K. Hwang and J.-M. Steyaert, On the number of heaps and the cost of heap construction, full version available via the link
  17. [18]
    D. E. Knuth, The Art of Computer Programming, Volume III—Sorting and Searching, Addison-Wesley, Second Edition, 1998.Google Scholar
  18. [19]
    C. J. H. McDiarmid and B. A. Reed, Building heaps fast Journal of Algorithms 10 (1989) 352–365.MathSciNetzbMATHCrossRefGoogle Scholar
  19. [20]
    K. Mehlhorn and A. Tsakalidis, Data structures, Chapter 6 of Handbook of Theoretical Computer Science pp. 301–341, Edited by J. van Leeuwen, Elsevier Science Publishers, Amsterdam, 1990.Google Scholar
  20. [21]
    H. Noltemeier, Dynamic partial orders and generalised heaps Computing (Supplement) 7 (1990) 125–139.MathSciNetCrossRefGoogle Scholar
  21. [22]
    W. Panny and H. Prodinger, Bottom up mergesort, a detailed analysis Algorithmica 14 (1995) 340–354.MathSciNetzbMATHCrossRefGoogle Scholar
  22. [23]
    V. V. Petrov Sums of Independent Random Variables Translated from the Russian by A. A. Brown, Springer-Verlag, Berlin-Heidelberg, New-York, 1975.CrossRefGoogle Scholar
  23. [24]
    T. Porter and I. Simon, Random insertion into a priority queue structure IEEE Transactions on Software Engineerings SE-1 (1975) 292–298.Google Scholar
  24. [25]
    F. P. Preparata and M. I. Shamos Computational Geometry Springer-Verlag, Berlin, 1985.CrossRefGoogle Scholar
  25. [26]
    R. Schaffer and R. Sedgewick, The analysis of heapsort Journal of Algorithms 15 (1993) 76–100.MathSciNetzbMATHCrossRefGoogle Scholar
  26. [27]
    R. Sprugnoli, Recurrence relations on heaps Algorithmica 15 (1996), 467–480.Google Scholar
  27. [28]
    I. Wegener, Bottom-up-Heapsort, a new variant of HEAPSORT beating, on an average, Quicksort (if n is not very small) Theoretical Computer Science 118 (1993) 81–98.MathSciNetzbMATHCrossRefGoogle Scholar
  28. [29]
    J. W. J. Williams, Algorithm 232: Heapsort Communications of the ACM 7 (1964) 347–348.Google Scholar

Copyright information

© Springer Basel AG 2002

Authors and Affiliations

  • Hwang Hsien-Kuei
    • 1
  • Steyaert Jean-Marc
    • 2
  1. 1.Institute of Statistical ScienceAcademia SinicaTaipeiTaiwan
  2. 2.Laboratoire d’InformatiqueÉcole PolytechniquePalaiseauFrance

Personalised recommendations