A Tight Bound on the Worst-Case Number of Comparisons for Floyd’s Heap Construction Algorithm

  • Ioannis PaparrizosEmail author
Conference paper
Part of the Springer Proceedings in Mathematics & Statistics book series (PROMS, volume 31)


In this paper a tight bound on the worst-case number of comparisons for Floyd’s well-known heap construction algorithm is derived.1 It is shown that at most \(2n - 2\mu (n) - \sigma (n)\) comparisons are executed in the worst case, where μ(n) is the number of ones and σ(n) is the number of zeros after the last one in the binary representation of the number of keys n.

Key words

Algorithm analysis Worst case complexity Data structures Heaps 


  1. 1.
    Aho, A.V., Hopcroft, J.E., Ullman, J.D.: The Design and Analysis of Computer Algorithms. Addison-Wesley Series in Computer Science and Information Processing, Addison-Wesley Publishing Company (1974)zbMATHGoogle Scholar
  2. 2.
    Cormen, T., Leiserson, C., Rivest, R., Stein, C.: Introduction to Algorithms, 2nd edn. MIT, Cambridge (2001)zbMATHGoogle Scholar
  3. 3.
    Floyd, R.: Algorithm 245: treesort 3. Comm. ACM 7, 701 (1964)CrossRefGoogle Scholar
  4. 4.
    Goodrich, M.T., Tamassia, R.: Algorithm Design, Foundations, Analysis, and Internet Examples. Wiley, New York (2002)zbMATHGoogle Scholar
  5. 5.
    Knuth, D.: The art of computer programming, vol. 3, 2nd edn. Searching and Sorting. Addison Wesley, Redwood city (1998)Google Scholar
  6. 6.
    Kruskal, C.P., Weixelbaum, D.: The worst case analysis of heapsort. Technical Report no 018a, Department of Computer Science, New York University (1979)Google Scholar
  7. 7.
    Paparrizos, I.: A tight bound on the worst-case number of comparisons for Floyd’s heap construction algorithm. In: Proceedings of the 37th International Conference on Current Trends in Theory and Practice of Computer Science (2011)Google Scholar
  8. 8.
    Schaffer, R.: Analysis of heapsort. Ph.D. Thesis, Department of computer science, Princeton University (1992)Google Scholar
  9. 9.
    Williams, J.W.J.: Algorithm 232: heapsort. Comm. ACM 6, 347–348 (1964)Google Scholar

Copyright information

© Springer Science+Business Media New York 2013

Authors and Affiliations

  1. 1.Computer Science DepartmentColumbia UniversityNew YorkUSA

Personalised recommendations