Quick Sort
Quick Sort
Section titled “Quick Sort”-
Choose a Pivot
Select an element to act as the pivot (commonly the last element). -
Partitioning
- Find a small element on the left of the pivot.
- Find a large element on the right of the pivot.
- Swap them to move smaller elements to the left and larger to the right.
- Repeat until left and right cross, then place pivot in correct position.
-
Recursive Sort
- Recursively apply the above steps to the sub-arrays to the left and right of the pivot.