Skip to content

Randomised quick sort

ordering

Level 3 of 3

Also called Randomised quicksort.

Quick sort with its pivot picked at random. In each part, pick a place at random, swap its number to the end, and split the part round it as quick sort does. Averaged over the picks, a row already in order, quick sort's worst case, costs the same as any other order of its numbers.

comparisons
0
swaps
0

step 1 of 1

Examples

Whole numbers from 1 to 99, between 2 and 12 of them, separated by commas or spaces. The picks come from the numbers you type, in their order, so the same row always gets the same picks and a run can be played again.