Quicksort

  • D. M. Steier
  • A. P. Anderson

Abstract

While insertion sort is widely used because it is so simple, it is possible to obtain much more efficient algorithms (when sorting large numbers of elements) by paying the price of a little extra complexity in algorithm design. For example, quicksort sorts by partitioning a sequence into two halves, sorting each half, and then combining the halves to produce a sorted sequence. The partitioning rearranges the sequence elements so that all elements to the left are less than or equal to all the elements to the right. The payoff is that the sorted subsequences can be merged by just concatenating them. Theoretically, partitioning around the median is necessary to achieve optimal performance (to balance sizes of the subproblems), but in practice an approximation to the median is good enough. Though quicksort has a potentially O(n2) performance, the average case performance is O(n log n). Hence it is the perferred sorting algorithm for large data sets in most cases.

Keywords

Sorting 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag New York Inc. 1989

Authors and Affiliations

  • D. M. Steier
    • 1
  • A. P. Anderson
    • 1
  1. 1.School of Computer ScienceCarnegie Mellon UniversityPittsburghUSA

Personalised recommendations