Counting Inversions In An Array Using Merge Sort

Problem Statement Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion count is the maximum. Specifically, if there are two numbers a[i] and a[j] where a[i] > a[j] and …

Counting Inversions In An Array Using Merge Sort Read More »