public static void main(String[] args) { int N = 30; int M = 10; int[] a = new int[N]; for (int i = 0; i < N; i++) a[i] = StdRandom.uniform(M); for (int i = 0; i < N; i++) StdOut.printf("%2d", a[i]); int[] h = histogram(a, M); StdOut.println("\n"); for (int i = 0; i < M; i++) StdOut.printf("%4d", h[i]); }
public static void main(String[] args) { int N = 2000; countops(N); // System.exit (0); double prevOps = ops; double prevTime = time; for (int i = 0; i < 12; i++) { N *= 2; countops(N); StdOut.printf("%8d %10d %5.1f [%5.3f %5.3f]\n", N, ops, ops / prevOps, time, time / prevTime); prevOps = ops; prevTime = time; } }
public static void main(String[] args) { for (int N = 250; true; N += N) { final double time = timeTrial(N); StdOut.printf("%7d %5.1f\n", N, time); } }