🧮Quicksort
Also known as Quick Sort, Partition-Exchange Sort
A fast sort. It splits items around a pivot, then sorts each side.
Think of it like
Think of it like lining up kids. Pick one kid; short kids go left, tall kids go right.
Example
Emma's quicksort picks 5 as the pivot for 8, 3, 5, 9, 1. It moves 3 and 1 left and 8 and 9 right, then sorts each side.
Why it matters
It is one of the fastest sorts in real use, and many built-in sorts start from it.
Definition
Common mistake
Key takeaways
- 1Pick a pivot. Smaller left, larger right.
- 2Repeat on each side. Until all is sorted.
- 3Fast on average. Slow with bad pivots.