[Solved] What is the space complexity of the code that uses merge sort for determining the number of inversions in an array?

What is the space complexity of the code that uses merge sort for determining the number of inversions in an array?

a) O(n)
b) O(log n)
c) O(1)
d) O(n log n)

Answer: a
Explanation: The space complexity required by the code will be O(n). It is the same as the space complexity of the code of standard merge sort.

Comments