Quick Sort

Visualize the divide-and-conquer approach with partitioning around a pivot

Size:
Speed:
Unsorted
Pivot/Comparing
Swapping
Sorted

About Quick Sort

Time Complexity:

  • Best: O(n log n) - balanced partitions
  • Average: O(n log n)
  • Worst: O(n²) - unbalanced partitions

Space Complexity: O(log n)

Stable: No

How It Works

Quick Sort uses a divide-and-conquer strategy by selecting a pivot element and partitioning the array so that elements smaller than the pivot come before it and larger elements come after.

The algorithm then recursively sorts the sub-arrays on either side of the pivot until the entire array is sorted.

šŸ’” Tip: Watch how the pivot gets placed in its final sorted position after each partition!