Implementing Quicksort programs

  title={Implementing Quicksort programs},
  author={Robert Sedgewick},
  journal={Commun. ACM},
  • R. Sedgewick
  • Published 1 October 1978
  • Computer Science
  • Commun. ACM
This paper is a practical study of how to implement the Quicksort sorting algorithm and its best variants on real computers, including how to apply various code optimization techniques. [] Key Method A detailed implementation combining the most effective improvements to Quicksort is given, along with a discussion of how to implement it in assembly language. Analytic results describing the performance of the programs are summarized. A variety of special situations are considered from a practical standpoint to…

Figures from this paper

The analysis of Quicksort programs

Results are derived which make it possible to obtain exact formulas describing the total expected running time of particular implementations on real computers of Quicksort and an improvement called the median-of-three modification.

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.

Loop Programming Practices that Simplify Quicksort Implementations

Loop programming and refactoring techniques that lead to simplified implementation for Hoare's quicksort algorithm consisting of a single loop are presented and may be used for the discovery of more novel algorithms.

Engineering a sort function

A new qsortfunction for a C library that 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.

QuickSort A Historical Perspective and Empirical Study

A comprehensive survey and empirical study of the Quicksort algorithm starting with the original version developed by Hoare in 1961 and ending with some of the most recent ones, which compared each algorithm in terms of the number of comparisons performed and the running times.

Triple State QuickSort, A replacement for the C/C++ library qsort

An industrial grade Quicksort function along with its new algorithm, which is meant as a replacement for the C/C++ library qsort().

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

A Meticulous Analysis of Mergesort Programs

The efficiency of mergesort programs is analysed under a simple unit-cost model, which includes the costs of key comparisons, element moves and address calculations, to establish the best possible time-bound relative to the model when sorting n integers.


The paper compares the running time performance of the existing quicksort partition algorithms with the proposed hybrid approach using unique and duplicate elements, and it is found that several the hybrid approaches performs faster than the existing algorithms for uniqueand duplicate elements.



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.

Sorting on STAR

  • H. Stone
  • Computer Science
    IEEE Transactions on Software Engineering
  • 1978
This paper gives timing comparisons for three sorting algorithms written for the CDC STAR computer. One algorithm is Hoare's Quicksort, which is the fastest or nearly the fastest sorting algorithm

Sorting in a paging environment

This sorting study was part of an extensive measurement project undertaken on the M44/44X, an experimental paging system which was conceived and implemented at IBM Research in order to explore the

Samplesort: A Sampling Approach to Minimal Storage Tree Sorting

A procedure is proposed which is a generalization of minimal storage tree sorting and which has the following three properties: there is a significant improvement in the expected number of comparisons required to sort the input sequence, the procedure is statistically insensitive to bias in theinput sequence, and the expected numbers of comparisons approaches the information-theoretic lower bound on the number of compared required.

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.

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

Some performance tests of “quicksort” and descendants

Detailed performance evaluations are presented for six ACM algorithms, and quicksort requires the fewest comparisons to sort random arrays and qsort requires many more comparisons than its author claims.

fundamental algorithms

General Instructions Material: You may only use one handwritten sheet of paper (size A4, on both pages) to solve the exercises and any other material including electronic devices of any kind is forbidden.

The art of computer programming: sorting and searching (volume 3)

Apparatus for supporting different nets for various sporting purposes including interengaging tubular rods which are arranged to interconnect and have ground engaging portions suitable to be useful

Algorithms 402: Increasing the efficiency of quicksort

A lgor i thm generates a l ist of complex primes in order of increasing modulus: the parameter m of the call is the highest modulus to be included in the list and should sat isfy m > 2.