01Partition around a pivot
Quicksort is divide and conquer with the work done before the recursion instead of after:
- Choose a pivot element, here the last one of the range.
- Partition: rearrange so everything smaller than the pivot is on its left and everything else on its right.
- The pivot now sits in its final sorted position. Recurse on the left part and on the right part.
No merge step is needed: once both sides are sorted, the whole range is sorted, because every left element is already smaller than every right one.