Count inversions in an array
[Question]: Given an array of N integers, count the inversion of the array (using merge-sort). What is an inversion of an array? Definition: for all i & j < size of array, if i < j then you have to find pair (A[i],A[j]) such that A[j] < A[i].Example 1:Input Format: N = 5, array[] = {1,2,3,4,5}Result: […]
Count inversions in an array Read More »