public class Permutations { static boolean[] pointsLeft; static int[] getFirstPermutation (int N) { pointsLeft = new boolean [N]; int[] permutation = new int [N]; // INSERT YOUR CODE HERE. return permutation; } static int[] getNextPermutation (int[] permutation) { // INSERT YOUR CODE HERE. return permutation; } //////////////////////////////////////////////////////////////////////// public static void main (String[] argv) { try { int N = 5; // Read number of items from command-line, if given. if (argv.length != 0) { N = Integer.parseInt (argv[0]); } runTest (N); } catch (Exception e) { e.printStackTrace(); } } static void runTest (int N) { int[] permutation = getFirstPermutation (N); int count = 0; while (permutation != null) { printPermutation (permutation); count ++; permutation = getNextPermutation (permutation); } int numPermutations = (int) factorial (N); if (numPermutations != count) { System.out.println ("Wrong number of permutations: num=" + count + " correct val=" + numPermutations); System.exit(1); } } static void printPermutation (int[] permutation) { String str = ""; for (int i=0; i