Quicksort Algorithm

A divide-and-conquer sorting algorithm with O(n log n) average time complexity

Compare Quicksort

How does Quicksort stack up against other sorting algorithms?

Quicksort vs. Merge Sort

  • Time Complexity: Both average O(n log n). Quicksort has a worst-case O(n²), while Merge Sort is always O(n log n).
  • Space Complexity: Quicksort is typically O(log n) (in-place partitioning), Merge Sort is O(n) (requires extra space).
  • Stability: Merge Sort is stable, Quicksort is not inherently stable.
  • Performance: Quicksort often performs better in practice due to lower constant factors and cache efficiency, especially for arrays stored contiguously.

More comparisons coming soon...