期刊文献+

An Improved HEAPSORT Algorithm with nlogn-0.788928n Comparisons in the Worst Case

An Improved HEAPSORT Algorithm with nlogn-0.788928n Comparisons in the Worst Case
原文传递
导出
摘要 A new variant of HEAPSORT is presented in this paper. The algorithm is not an internal sorting algorithm in the strong sense, since extra storage for n integers is necessary. The basic idea of the new algorithm is similar to the classical sorting algorithm HEAPSORT, but the algorithm rebuilds the heap in another way. The basic idea of the new algorithm is it uses only one comparison at each node. The new algorithm shift walks down a path in the heap until a leaf is reached. The request of placing the element in the root immediately to its destination is relaxed. The new algorithm requires about n log n - 0.788928n comparisons in the worst case and n log n - n comparisons on the average which is only about 0.4n more than necessary. It beats on average even the clever variants of QUICKSORT, if n is not very small. The difference between the worst case and the best case indicates that there is still room for improvement of the new algorithm by constructing heap more carefully. A new variant of HEAPSORT is presented in this paper. The algorithm is not an internal sorting algorithm in the strong sense, since extra storage for n integers is necessary. The basic idea of the new algorithm is similar to the classical sorting algorithm HEAPSORT, but the algorithm rebuilds the heap in another way. The basic idea of the new algorithm is it uses only one comparison at each node. The new algorithm shift walks down a path in the heap until a leaf is reached. The request of placing the element in the root immediately to its destination is relaxed. The new algorithm requires about n log n - 0.788928n comparisons in the worst case and n log n - n comparisons on the average which is only about 0.4n more than necessary. It beats on average even the clever variants of QUICKSORT, if n is not very small. The difference between the worst case and the best case indicates that there is still room for improvement of the new algorithm by constructing heap more carefully.
出处 《Journal of Computer Science & Technology》 SCIE EI CSCD 2007年第6期898-903,共6页 计算机科学技术学报(英文版)
基金 Supported by the Natural Science Foundation of Fujian under Grant No.A0510008.
关键词 data structures analysis of algorithms heaps HEAPSORT data structures, analysis of algorithms, heaps, HEAPSORT
  • 相关文献

参考文献16

  • 1Knuth D E. The Art of Computer Programming Sorting and Searching. 2nd Edition, New York: Addison Wesley, 1998.
  • 2Floyd R W. Algorithm 245: Treesort 3. Communications of the ACM, 1964, 7(4): 701.
  • 3Williams J W J. Algorithm 232: HEAPSORT. Communications of the ACM, 1964, 7(4): 347-348.
  • 4Wegener I. BOTTOM-UP-HEAPSORT, a new variant of HEAPSORT, beating on an average, QUICKSORT (if n is not very small). Theoretical Computer Science, 1993, 118(1): 81-98.
  • 5Carlsson S. A variant of HEAPSORT with almost optimal number of comparisons. Information Processing Letters, 1987, 24(3): 247-250.
  • 6Wegener I. The worst case complexity of McDiarmid and Reed's variant of BOTTOM-UP HEAPSORT is less than n log n + 1.1n. Information and Computation, 1992, 97(1): 86-96.
  • 7Gonnet O H, Munro J I. Heaps on heaps. SIAM Journal on Computing, 1986, 15(6): 964-971.
  • 8McDiarmid C J H, Reed B A. Building heaps fast. Journal of Algorithms, 1989, 10(3): 352-365.
  • 9Hoare C A R. Quicksort. Computer Journal, 5(1): 10-15.
  • 10Dutton R D. Weak heap sort. BIT, 1993, 33(3): 372-381.

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部