Sunday, September 30, 2012

Number of inversions

Given an array. Find the number of inversions (if ith element is greater than jth element where i<j)
Eg: arr = {3,5,7,2,8}
Output: 3 ( 3>2, 5>2, 7>2)

No comments:

Post a Comment