ENGINEERING A SORT FUNCTION

被引:99
作者
BENTLEY, JL
MCILROY, MD
机构
[1] AT & T Bell Laboratories, Murray Hill, New Jersey, 07974
关键词
QUICKSORT; SORTING ALGORITHMS; PERFORMANCE TUNING; ALGORITHM DESIGN AND IMPLEMENTATION; TESTING;
D O I
10.1002/spe.4380231105
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
We recount the history of a new qsort function for a C library. Our function is clearer, faster and more robust than existing sorts. It chooses partitioning elements by a new sampling scheme; it partitions by a novel solution to Dijkstra's Dutch National Flag problem; and it swaps efficiently. Its behavior was assessed with timing and debugging testbeds, and with a program to certify performance. The design techniques apply in domains beyond sorting.
引用
收藏
页码:1249 / 1265
页数:17
相关论文
共 26 条
[1]  
Bentley J. L., 1986, PROGRAMMING PEARLS
[2]  
BENTLEY JL, 1992, UNIX REV, V10, P85
[3]  
BENTLEY JL, 1992, UNIX REV, V10, P71
[4]  
BENTLEY JL, 1991, UNIX REV, V9, P38
[5]  
Dijkstra EW, 1976, DISCIPLINE PROGRAMMI
[6]  
FRASER CW, 1991, SIGPLAN NOTICES, V26, P29, DOI 10.1145/122616.122621
[7]   QUICKSORT [J].
HOARE, CAR .
COMPUTER JOURNAL, 1962, 5 (01) :10-&
[8]  
Kernighan Brian W., 1983, UNIX PROGRAMMING ENV
[9]  
Knuth D. E., 1974, Computing Surveys, V6, P261, DOI 10.1145/356635.356640
[10]   THE ERRORS OF TEX [J].
KNUTH, DE .
SOFTWARE-PRACTICE & EXPERIENCE, 1989, 19 (07) :607-685