(long arr[],long s, long f)
| 11 | |
| 12 | } |
| 13 | public static long mergeSort(long arr[],long s, long f) |
| 14 | { |
| 15 | long inv_count=0; |
| 16 | if(s<f) |
| 17 | { |
| 18 | long mid=s+(f-s)/2; |
| 19 | inv_count+=mergeSort(arr,s,mid); //left sub problem! |
| 20 | inv_count+=mergeSort(arr,mid+1,f); //right ub problem! |
| 21 | inv_count+=merge(arr,s,mid,f); |
| 22 | } |
| 23 | return inv_count; |
| 24 | } |
| 25 | |
| 26 | public static long merge(long arr[],long s,long m, long e) |
| 27 | { |