Skip to content
quickselect
EntityQ3927837· pop 11· linked from 27 articles

quickselect

Sign in to save

Also known as Hoare's selection algorithm

In computer science, quickselect is a selection algorithm to find the kth smallest element in an unordered list, also known as the kth order statistic. Like the related quicksort sorting algorithm, it was developed by Tony Hoare, and thus is also known as '''Hoare's selection algorithm'''. Like quicksort, it is efficient in practice and has good average-case performance, but has poor worst-case performance. Quickselect and its variants are the selection algorithms most often used in efficient real-world implementations.

Key facts

Algorithm.name
Quickselect
Algorithm.class
Selection algorithm
Algorithm.image
Animated visualization of the quickselect algorithm. Selecting the 22st smallest value.
Algorithm.caption
Animated visualization of the quickselect algorithm. Selecting the 22nd smallest value.
Algorithm.data
Array
Algorithm.best time
O(n)
Algorithm.average time
O(n)
Algorithm.time
O(n2)
Algorithm.space
O(1)

via Wikipedia infobox

Wikidata facts

Image
Selecting quickselect frames.gif
Show 1 more fact
time of discovery or invention
1961-00-00

via Wikidata · CC0

~6 min read

Article

6 sections
Contents
  • Algorithm
  • Time complexity
  • Variants
  • See also
  • References
  • External links

In computer science, quickselect is a selection algorithm to find the kth smallest element in an unordered list, also known as the kth order statistic. Like the related quicksort sorting algorithm, it was developed by Tony Hoare, and thus is also known as '''Hoare's selection algorithm. Like quicksort, it is efficient in practice and has good average-case performance, but has poor worst-case performance. Quickselect and its variants are the selection algorithms most often used in efficient real-world implementations.

Quickselect uses the same overall approach as quicksort, choosing one element as a pivot and partitioning the data in two based on the pivot, accordingly as less than or greater than the pivot. However, instead of recursing into both sides, as in quicksort, quickselect only recurses into one side – the side with the element it is searching for. This reduces the average complexity from O(n\log n) to O(n), with a worst case of O(n^2).

Available in 11 languages

via Wikidata sitelinks · CC0

Connections

Categories