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,

Introspective sorting and selection revisited

Experimental results show that a simple rule for fine‐grained introspection that detects potential worst‐case performance after only a small constant number of partitioning steps and the use of remedial randomization as an intervention strategy in order to reduce the performance penalty for false positives provide significant improvements in the running time.

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).

Java 7's Dual-Pivot Quicksort

This thesis focuses on the precise and detailed average case analysis of Quicksort, aiming at the flavor of Knuth's series “The Art of Computer Programming”, and tries to understand the efficiency of the algorithms at different levels of abstraction.



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.

Programming pearls

This book is about programming pearls whose origins lie beyond solid engineering, in the realm of insight and creativity, and a new theme in this edition is how to evaluate and use software components.

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