
File:Sorting_quicksort_anim.gif · Wikimedia Commons · See Wikimedia Commons
quicksort
Sign in to saveAlso known as partition-exchange sort
Quicksort is an efficient, general-purpose sorting algorithm. Quicksort was developed by British computer scientist Tony Hoare in 1959 and published in 1961. It is still a commonly used algorithm for sorting. Overall, it is slightly faster than merge sort and heapsort for randomized data, particularly on larger distributions.
Quicksort is an efficient algorithm developed in 1961 that arranges data into order, and it remains widely used in computing today. It typically performs slightly faster than other popular sorting methods, especially when handling large amounts of random data.
AI-generated from the Wikipedia summary — may contain errors.
Key facts
- Algorithm.name
- Quicksort
- Algorithm.class
- Sorting algorithm
- Algorithm.image
- Sorting quicksort anim.gif
- Algorithm.caption
- Animated visualization of the quicksort algorithm. The horizontal lines are pivot values.
- Algorithm.time
- O(n^2)
- Algorithm.average time
- O(n\log n)
- Algorithm.best time
- O(n\log n) (simple partition)or O(n) (three-way partition and equal keys)
- Algorithm.space
- O(n) auxiliary (naive)O(\log n) auxiliary (Hoare 1962)
- Algorithm.optimal
- No
- Algorithm.stability
- Not Stable
via Wikipedia infobox
Wikidata facts
- Image
- Quicksort-diagram.svg
Show 3 more facts
- Stack Exchange tag
- stackoverflow.com/tags/quicksort
- Commons category
- Quicksort
- time of discovery or invention
- 1961-00-00
via Wikidata · CC0
~43 min read
Article
31 sectionsContents
- History
- Algorithm
- Lomuto partition scheme
- Hoare partition scheme
- Implementation issues
- Choice of pivot
- Repeated elements
- Optimizations
- Parallelization
- Formal analysis
- Worst-case analysis
- Best-case analysis
- Average-case analysis
- Using percentiles
- Using recurrences
- Using a binary search tree
- Space complexity
- Relation to other algorithms
- Selection-based pivoting
- Variants
- Multi-pivot quicksort
- External quicksort
- Three-way radix quicksort
- Quick radix sort
- BlockQuicksort
- Partial and incremental quicksort
- Generalization
- See also
- Notes
- References
- External links
Quicksort is an efficient, general-purpose sorting algorithm. Quicksort was developed by British computer scientist Tony Hoare in 1959 and published in 1961. It is still a commonly used algorithm for sorting. Overall, it is slightly faster than merge sort and heapsort for randomized data, particularly on larger distributions.
Quicksort is a divide-and-conquer algorithm. It works by selecting a "pivot" element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. For this reason, it is sometimes called partition-exchange sort. The sub-arrays are then sorted recursively. This can be done in-place, requiring small additional amounts of memory to perform the sorting.