Inversion Counting
Return the number of inversions in a vector. That is, the number of pairs of indices \({i, j}\) such that \(i < j\) and \(A_i > A_j\).
Complexity: \(\mathcal{O}(N\log(N))\)
Return the number of inversions in a vector. That is, the number of pairs of indices \({i, j}\) such that \(i < j\) and \(A_i > A_j\).
Complexity: \(\mathcal{O}(N\log(N))\)