410 views
0 votes
0 votes

Let an array A has n elements, where each element is a natural number. it is known that the array A has exactly r number of inversions. now every element int he array is made negative. then the time complexity of the most efficient algorithms which computes the inversion pairs in the modified array A will be?

 

Given answer: O(1)

My answer: O(n logn), because they have asked the inversion pairs, not the number of inversions. had they been asked the number of inversions, answer would be O(1).

please give your approach, and what do you think answer should be?

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
4