quicksort

Divide-and-conquer algorithm

Quicksort is a sorting algorithm that works by selecting a pivot element and partitioning the remaining elements into two groups—those less than the pivot and those greater—then recursively sorting each group.

It's among the fastest general-purpose sorting methods in practice, though its worst-case performance depends on pivot selection: The library uses quicksort for most array operations.

algorithm

pivot

Point of rotation

randomized · sublists · comparator · swap · sentinel

recursion

subarray

Contiguous sequence within array

depth-first · unwinding · termination

implementation

array

Ordered collection or display

  • indexAlphabetical guide to contents
  • lowNot elevated
  • highGreat in altitude

swap · pointer · iteration · in-place · sentinel · boundary · threshold · cutoff · vectorized

complexity

worst-case

Most unfavorable outcome imaginable

amortized · asymptotic · performance · overhead

Opposites
sorting stability

quicksortmergesort

Recursive divide-and-conquer sorting algorithm

Family

quick, sort, quickly, quickness, quickest, quicker, quickstep, quicksilver, quickset

Familiarity
Top 1,000,000
Profile
Used worldwide · Timeless · Abstract · Rated G