Quick Sort
Divide and conquer sorting with visible partition boundaries
Put one pivot in its final place
Quick Sort chooses a pivot, partitions the current range so smaller values are on its left and larger values are on its right, then repeats the same job on both sides. Once partitioning finishes, that pivot is already in its final sorted position.
What the visualization shows
This page uses Lomuto partitioning with the last value as the pivot. The side panel is an explicit interval stack that replaces recursion. Watch the scan pointer move, the less-than region grow, and each pivot become fixed. Change the input to test favorable, reversed, or duplicate-heavy data.
Pop interval [0, 9] from the work stack.
Complexity and tradeoffs
Average time is O(n log n), auxiliary stack space is typically O(log n), and partitioning is in-place. Quick Sort is not stable. Consistently bad pivots can produce O(n^2) time, so practical implementations randomize or improve pivot selection.
i are smaller than the pivot, while values from i through the previous scan position are at least the pivot. Keeping that statement true explains why the final pivot swap is correct. Compare its growth rate in the complexity reference, or continue with Binary Search to see another logarithmic divide-and-conquer pattern.