Partition
Push everything smaller than the pivot to its left, then drop the pivot between the groups.
Quick Sort: Seven values
Swap the pivot 7 with 8 so it lands between the two groups.
Cost
- Best
- O(n)
- Average
- O(n)
- Worst
- O(n)
- Space
- O(1)
Before this
Variants
- Lomuto Partition
- Hoare Partition
Leads to
Topics that need this one first.
Taught by the same lesson
Quick Sort covers these too, in the same run.