Skip to content

Quickselect

finding

Level 3 of 3

Also called Hoare's selection algorithm.

Find the number that would stand at a given place if the row were in order, without putting it in order. Split the row round a pivot as quick sort does, then keep only the side that holds the place you want.

comparisons
0
swaps
0

step 1 of 1

Examples

Whole numbers from 1 to 99, between 2 and 12 of them, then a semicolon and the place to find, counted from the smallest, for example 42, 7, 31, 18; 2.