Merge sort - inversions count
In an array, arr = [a0, a1, …, aN-1] , the elements at indices i and j (where i < j) form an inversion if aI > aJ. In other words, inverted elements and are considered to be “out of order”. To correct an inversion, we can swap adjacent elements.