Solution: Inversion Count in an Array
Learn to calculate the inversion count using the divide and conquer paradigm.
We'll cover the following...
We'll cover the following...
Solution 1
The naive solution to this problem involves the following:
- We pick an element from the array.
- We compare it with all elements to its right.
- If the element on the right is smaller, we increment the inversion count.
Time complexity
The array is traversed once for each element in it. It runs in ...