Engineering a sort function

  title={Engineering a sort function},
  author={Jon Louis Bentley and M. Douglas McIlroy},
  journal={Software: Practice and Experience},
We recount the history of a new qsortfunction 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. 

Pattern-defeating Quicksort

A new solution for the Dutch national flag problem is proposed, requiring no three-way comparisons, which gives quicksort a proper worst-case runtime of O(nk) for inputs with k distinct elements.

A better approach to QuickSort implementation

This paper formulates an alternative implementation of Quicksort that is faster and simpler and based on some profound basic principles and a better partitioning algorithm.

Experiments for Algorithm Engineering

A highly tuned version of the Quicksort algorithm was implemented in the Unix system’s main memory sort function, qsort, for two decades, and performed admirably.

A Performance Study of Some Sophisticated Partitioning Algorithms

A careful study of partitioning algorithms on modern machines with the help of state of the art performance analyzers, chooses the best partitioning algorithm on the basis of some crucial performance indicators.

Engineering Java 7's Dual Pivot Quicksort Using MaLiJan

This paper uses the new tool MaLiJAn to confirm that asymmetric pivot choices are preferable to symmetric ones for this Quicksort variant asymptotically for combinatorial cost measures such as the total number of executed instructions.

Review of algorithms and data structures: the basic toolbox by Kurt Mehlhorn and Peter Sanders

A toolbox: in the hands of an accomplished craftsman, it has a carefully selected set of the most commonlyused implements appropriate to the most frequently-encountered tasks. In the hands of a hack,

Building a new sort function for a C library

A library function based on Chen's Proportion Extend Sort (psort) which is robust and faster than BM qsort is introduced, inspired by the fact that psort is generally faster than qsort, and in the worst case, qsort requires O(n2) comparisons, while psort requiresO(n log n).

Towards Automation Of Sorting Implementations For SIMD Architectures

The experiments performed on Intel Core-2 duo and Power-4 processors using icc and gcc compilers show that the approach improves the performance of the sorting code on these architectures.

Accessing hardware performance counters in order to measure the influence of cache on the performance of integer sorting

It is demonstrated through experiments on an Athlon processor that a good balance between L1 data cache misses and retired instructions provides the fastest algorithm for sorting in practical cases and a new flavour of merge-sort is developed and it beats its rival.



Implementing Quicksort programs

A detailed implementation combining the most effective improvements to Quicksort is given, along with a discussion of how to implement it in assembly language, including how to apply various code optimization techniques.

The UNIX system: Theory and practice in the construction of a working sort routine

  • J. P. Linderman
  • Computer Science
    AT&T Bell Laboratories Technical Journal
  • 1984
Because comparison in the standard UNIX™ operating system sort routine, /bin/sort, is interpretive, it is generally more time-consuming than the standard paradigm of comparing two integers. When a

Quicksort with Equal Keys

It is shown that, of the three strategies which have been suggested for dealing with equal keys, the method of always stopping the scanning pointers on keys equal to the partitioning element performs best.

A retargetable compiler for ANSI C

lcc is a new retargetable compiler for ANSI C. Versions for the VAX, Motorola 68020, SPARC, and MIPS are in production use at Princeton University and at AT&T Bell Laboratories. With a few

The errors of tex

  • D. Knuth
  • Computer Science
    Softw. Pract. Exp.
  • 1989
The history of the TEX project can teach valuable lessons about the preparation of highly portable software and the maintenance of programs that aspire to high standards of reliability.

Algorithms in C

Algorithms in C is a comprehensive repository of algorithms, complete with code, with extensive treatment of searching and advanced data structures, sorting, string processing, computational geometry, graph problems, and mathematical algorithms.

A Framework for Adaptive Sorting

Optimistic sorting and information theoretic complexity

Simple modifications to insertion sort and merge sort improve their performance on incompletely shuffled data, and the modified merge sort proves efficient both in theory and in practice.

Structured Programming with go to Statements

For serious students of structured programming, and also for language designers, Knuth's "Structured Programming with go to Statements" is probably the paper to read. It is by far the most complete

Algorithm 347: an efficient algorithm for sorting with minimal storage [M1]

The real procedure gauss computes the area under the left-hand portion of the normal curve by using National Bureau of Standards formulas 26.6.4, 26.5, and 26.8 for computation of the statistic and the approximation for the approximation.