algorithms.tutorialhorizon.com
Find number of reverse pairs in an array | Algorithms
Objective: Given an array of integers A[], find no of reverse pairs means no of (i, j) pairs where i < j and A[i]>A[j]. Example: A[] = {10, 3, 4, 2, 5, 7, 9, 11} Output: 7 Reversed pairs: (10, 3) (10, 4) (10, 2) (10, 5) (10, 7) (10, 9) (3, 2) (4, 2) = 8