Algorithms

Quick sort

A sorting algorithm that picks a pivot, puts smaller values on one side and larger on the other, and repeats with each side. O(n log n) on average and in place.

Example

With 1 million items it takes about 20 million steps on average, with no extra array.

Test yourself: Quick sort

Quick sort

After partitioning with pivot 3, everything to its left is ___ 3.

Lessons that use it

More algorithms terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.