Today I was looking the latest exam of the local informatics olympiad and I found a interesting problem. Briefly, it asks to, given an integer array, count how many inversions i
O(n log n) is the best as far as I know.
A detailed explanation was given here:
http://www.geeksforgeeks.org/counting-inversions/