704 views
0 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.

Position:
Show:

Related questions

0 0 votes
0 0 answers
1.3k
1.3k views
Prateek Raghuvanshi asked Dec 29, 2018
1,315 views
assume a CPU processor is designed with FIFO replacement policy and memory is byte addressable .processor uses cache memory for faster output.A set of instruction is exe...
0 0 votes
1 1 answer
1.8k
1.8k views
Prateek Raghuvanshi asked Dec 29, 2018
1,848 views
Assume that A and B are only active stations on an ethernet.both has a steady queue of frames to send .to get the control on the channel they uses binary exponential algo...
0 0 votes
1 1 answer
1.6k
1.6k views
aambazinga asked Dec 27, 2018
1,596 views
A large number of consecutive IP address are available starting at 198.16.0.0. Suppose that four organizations, A, B, C, and D, request 4000, 2000, 4000, and 8000 address...
0 0 votes
0 0 answers
872
872 views
Prateek Raghuvanshi asked Dec 23, 2018
872 views
consider the following function secret (). unsigned char secret(unsigned char x,int y) { return ((x & 0x0F)<<y | (x & 0xF0)>>y); } int main() { unsigned char x=100; ...