What is the space complexity of the merge sort algorithm?

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

Correct answer A

Merge Sort requires extra memory to merge sorted subarrays. It is not an in-place algorithm. Therefore, its space complexity is O(n) for an array of size n. Key facts: Time complexity (Best) → O(n log n) Time complexity (Average) → O(n log n) Time complexity (Worst) → O(n log n) Recursion stack → O(log n).