Quick Sort
6 min read.
A highly efficient Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot.
Think of it this way: Imagine a teacher lining students up by height. She picks one student (the pivot) and says: 'Shorter to the left, taller to the right.' Now she has two smaller groups and repeats. Much faster than moving one student at a time!
Start: pick a pivot, move smaller values left of it, then sort each side.
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
Partition around a pivot
Order one level of quick sort (Lomuto partition).
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
Quiz
20 questionsWhat is the "Partition" step in Quick Sort?
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.