Do all parts of problem 2.8 on page 50 of the text. Consider using the profiler discussed in class to do part d.
Submit your homework as a report containing your source code (1 - 3 and c), correctness proofs (a), performance analyses (b, e), and profiling output (d).
Hint: I don't know if this will help, but here's the class declaration I used:
public class Perm {
// utilities:
private static Random generator = new
Random();
private static int randInt(int i, int
j) { ??? }
private static String toString(int[]
nums) { ??? }
// algorithms (for parts 1 - 3):
public static void perm1(int[] nums) {
??? }
public static void perm2(int[] nums) {
??? }
public static void perm3(int[] nums) {
??? }
// tests (for part c):
public static void test1() { ??? }
public static void test2() { ??? }
public static void test3() { ??? }
public static void main(String[] args)
{
if (args[0].equals("test1"))
test1();
if (args[0].equals("test2"))
test2();
if (args[0].equals("test3"))
test3();
System.out.pritnln("done");
}
}