• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

J4 ›› 2014, Vol. 36 ›› Issue (A2): 273-275.

• 论文 • 上一篇    下一篇

从n个元素中选取前k(k〈〈n)个元素的排序方法

冯广慧,陈守孔   

  1. (吉林大学珠海学院,广东 珠海 519041
  • 收稿日期:2014-06-13 修回日期:2014-08-20 出版日期:2014-12-25 发布日期:2014-12-25

Sorting methods for selecting the top
k(k〈〈n)elements in a set of n elements 

FENG Guanghui,CHEN Shoukong   

  1. (Zhuhai College,Jilin University,Zhuhai 519041,China)
  • Received:2014-06-13 Revised:2014-08-20 Online:2014-12-25 Published:2014-12-25

摘要:

首先叙述了常见的几种排序方法,分析了各自的优缺点,指出了每趟排序都至少有一个元素能确定自己最终位置的排序方法。重点分析了堆排序与快速排序,提出在大量元素中找出前几个元素时,堆排序和快速排序方法相比,使用快速排序解决此类问题效率更佳。

关键词: 排序, 堆排序, 快速排序

Abstract:

In this paper,we firstly describe several common sorting methods,analyze their merits and shortcomings,and then propose some sorting methods which can determine the final position of at least one element during each trip of sorting.We discuss heapsort algorithm and quicksort algorithm in particular.Through the comparison of these methods,it shows that the quicksort is often better than heapsort when finding out the first several elements among a large number of elements.

Key words: sort;heapsort;quicksort