What is the space complexity of the Quicksort algorithm?

  • AO(log n)
  • BO²(log n)
  • CO(log n²)
  • DNone of these
Show answerHide answer

Correct answer A

Quick Sort is an in-place sorting algorithm. It does not require extra arrays, but uses recursion stack space. On average, recursion depth is log n, so space complexity is O(log n). Key facts: Average space → O(log n) Best case → O(log n) Worst case → O(n) (unbalanced recursion) Time (average) → O(n log n).