@Test public void randomTest() { Random r = new Random(); for (int j = 1; j <= 10; j++) { int N = 3000 * j; int[] arr = new int[N]; for (int i = 0; i < arr.length; i++) arr[i] = ((-N / 2) + r.nextInt(N)) / (j * j * j); int expect = reversePairs(arr); Assert.assertEquals(expect, countInversion.solve(arr)); } }
public int solve(int[] arr) { Integer[] convert = new Integer[arr.length]; for (int i = 0; i < arr.length; i++) { convert[i] = arr[i]; } return mergeSorter.template(convert,0,arr.length - 1, 0, new CountInversionMerger(), new SumResultAggr()); }
CountInversion { public int solve(int[] arr) { Integer[] convert = new Integer[arr.length]; for (int i = 0; i < arr.length; i++) { convert[i] = arr[i]; } return mergeSorter.template(convert,0,arr.length - 1, 0, new CountInversionMerger(), new SumResultAggr()); } }
CountInversion { public int solve(int[] arr) { Integer[] convert = new Integer[arr.length]; for (int i = 0; i < arr.length; i++) { convert[i] = arr[i]; } return mergeSorter.template(convert,0,arr.length - 1, 0, new CountInversionMerger(), new SumResultAggr()); }  }
CountInversion { public int solve(int[] arr) { Integer[] convert = new Integer[arr.length]; for (int i = 0; i < arr.length; i++) { convert[i] = arr[i]; } return mergeSorter.template(convert,0,arr.length - 1, 0, new CountInversionMerger(), new SumResultAggr()); }  int solve(int[] arr); }
CountInversion { public int solve(int[] arr) { Integer[] convert = new Integer[arr.length]; for (int i = 0; i < arr.length; i++) { convert[i] = arr[i]; } return mergeSorter.template(convert,0,arr.length - 1, 0, new CountInversionMerger(), new SumResultAggr()); }  int solve(int[] arr);  }