+ 2
Finding number of perfect inverted pairs
An inverted pair in a sequence of numbers a1, a2, a3.... is defined as a pair < ai , aj > such that i<j and ai > aj . Now we define a perfect inverted pair as a pair < ai , aj > such that i<j and ai > 2 â aj . Given a finite sequence of numbers, you need to find the number of perfect inverted pairs. Input-5 2 3 4 1//array original output-4 input-5 6 7 5 1 2 3 output-9 Note:- this questiin has ti be done in nlog n complexity
4 Answers
+ 1
Is this work for school or university? No way I'm going to help you cheating.
+ 1
Ok, I apologize.
0
it is just a practice question that i have got from my friend.
0
i have done this but in n^2 .