Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

The least basic operations on heap and improved heapsort

  • 34 Accesses

  • 2 Citations


The best algorithms of INSERT and DELETE operations on heap is presented, by which HEAPSORT is improved. Inserting one element into and deleting one element from a heap ofn elements spend at most ⌈log logn⌉ comparisons and ⌊logn⌋ comparisons and transfers of element in the worst cases respectively. The improved HEAPSORT spendsn logn+n log logn+O(n) comparisons and element trnasfers (not swap!) in the worst case. It may be the best HEAPSORT algorithm since the lower bound of sorting algorithm ⌈logn!⌉ ≈n logn+O(n). Especially, in element transfer, this is the best result we known so far.

This is a preview of subscription content, log in to check access.


  1. [1]

    Aho A V,et al. The design and analysis of computer algorithms. Addison-Wesley, Reading, MA, 1976, pp. 87–92.

  2. [2]

    Cook C, Kim D. Best sorting algorithm for nearly sorted lists.CACM, 1980, 23(11): 620–626.

  3. [3]

    Gu Xunrang, Zhu Yuzhang. Improved heapsort algorithm and its complexity analysis.Chinese Journal of Computers, 1990, 13(4): 289–292.

  4. [4]

    Zhu Honget al. The design and analysis of algorithm (in Chinese). Shanghai Scientific and Technological Literature Publishing House, 1989, pp. 15–32.

  5. [5]

    Hayward R, Mcdiarmid C. Average case analysis of heap building by repeated insertion.Journal of Algorithms, 1991, 12(1).

  6. [6]

    Reinhardt K. Sorting in-place with a worst case complexity ofn logn−1.3n+O(logn) comparisons and ∈n logn+O (1) transports. In: Proc. 3rd Annual Int'l Symp. Algorithms and Computation, 1992.

Download references

Author information

Correspondence to Jigang Wu.

Additional information

Supported by National Natural Science Foundation of China under Grant 6907330.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Wu, J., Zhu, H. The least basic operations on heap and improved heapsort. J. of Compt. Sci. & Technol. 9, 261–266 (1994). https://doi.org/10.1007/BF02939507

Download citation


  • Heap
  • insert
  • delete
  • lower bound
  • comparison
  • complexity
  • element transfer