A shelf of unsorted numbers doesn’t need a global plan to become sorted — it needs one honest decision, made once, that never has to be revisited. Pick a pivot, walk the row exactly once, and shove everything smaller to its left and everything bigger to its right. That pivot is now home. Do the same to what’s left on each side, and the array sorts itself from the middle outward. Step through the partition below against the live pseudocode and watch the boundary lines move.

Leave a Reply