+1 vote
in Data Structures & Algorithms I by (110k points)
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)

My query is from Arrays Types in portion Arrays Types of Data Structures & Algorithms I

I have been asked this question in an international level competition.

1 Answer

+1 vote
by (444k points)
selected by
Best answer
Right answer is (a) O(n)

Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.