@@ -0,0 +1,1216 @@
+/* Formally speaking, two elements a%5Bi%5D and a%5Bj%5D form an inversion %0A%0A                            %0A                            if a%5Bi%5D %3E a%5Bj%5D and i %3C j%0A%0A                            i.e if a%5Bi%5D %3E a%5Bj%5D & i%3Cj  increment count%0A%0A%0AExample:%0AThe sequence 2, 4, 1, 3, 5 has 3 inversions (2, 1), (4, 1), (4, 3). %0A8, 12, 3, 10, 15 has 3 inversions (8, 3), (12, 3), (12, 10)%0A1, 20, 6, 4, 5 has 5 inversions (20, 6), (20, 4), (20, 5), (6, 4) and (6, 5).%0A%0ARunning Time of this code - O(n*n)%0A*/%0A%0Aimport java.util.Scanner;%0A%0Apublic class InversionCount%7B%0A%0A%09public static int inverseCount(int%5B%5D array,int N)%7B%0A%0A%09%09int count = 0;%0A%0A%09%09for(int i=0;i%3CN-1;i++)%7B%0A%09%09%09for (int j=i+1;j%3CN ;j++ ) %7B%0A%09%09%09%09if (array%5Bi%5D%3Earray%5Bj%5D)%0A%09%09%09%09%09count++;%09%09%09%0A%09%09%7D%0A%09%7D%0A%0A%09%09return count ;%0A%09%7D%0A%0A%09public static void main(String args%5B%5D)%7B%0A%0A%09%09Scanner scanf = new Scanner(System.in);%0A%0A%09%09System.out.println(%22Testing inversion count%5Cn%22);%0A%0A%09%09int N,i;%0A%0A%09%09System.out.println(%22Enter size of array%22);%0A%09%09N = scanf.nextInt();%0A%0A%09%09int arr_req%5B%5D = new int%5BN%5D;%0A%0A%09%09System.out.println(%22%5CnEnter %22+ N +%22 integer elements%22);%0A%0A%09%09for (i = 0; i %3C N; i++)%0A            arr_req%5Bi%5D = scanf.nextInt();%0A%0A        int count = inverseCount(arr_req,N);%0A%0A        System.out.println(%22Count is %22 + count);%0A%0A%09%7D%0A%7D%0A

Create InversionCount.java