Counting the number of inversions in a list
Given an array of numbers, how do we count the number of inversions in it? Suppose we are sorting an array of numbers in increasing order, an inversion is an ordered pair of indices (i,j) such that i < j and A[i] > A[j] . For example consider the array {3, 2, 1,…