I\'m designing an algorithm to do the following: Given array A[1... n], for every i < j, find all inversion pairs such that A[i] > A[j]
A[1... n]
i < j
A[i] > A[j]
Check this out: http://www.cs.jhu.edu/~xfliu/600.363_F03/hw_solution/solution1.pdf
I hope that it will give you the right answer.