import java.util.Arrays; public class Inversion { /* * Counts the number of inversions of a given permutation using * the Divide and Conquer paradigm. * * @param n The length of the permutation. * * @param perm A permutation of the elements [0, 1, ..., n-1]. * That is, those elements 0,1,..., n-1 in some order. * * @return The number of inversions of perm. */ public static int countInversions(int n, int[] perm) { assert perm.length == n; // TODO: Remove the following lines and complete this method. int result = -1; return result; } /* * If you want to write your own tests, put them here. */ public static void main(String[] args) { } }