MCPcopy Create free account
hub / github.com/careercup/ctci / main

Method main

java/Chapter 9/Introduction/FibonacciFB.java:23–41  ·  view source on GitHub ↗

@param args

(String[] args)

Source from the content-addressed store, hash-verified

21 * @param args
22 */
23 public static void main(String[] args) {
24 int trials = 10; // Run code multiple times to compute average time.
25 double[] times = new double[max]; // Store times
26
27 for (int j = 0; j < trials; j++) { // Run this 10 times to compute
28 for (int i = 0; i < max; i++) {
29 fib = new int[max];
30 long start = System.currentTimeMillis();
31 fibonacci(i);
32 long end = System.currentTimeMillis();
33 long time = end - start;
34 times[i] += time;
35 }
36 }
37
38 for (int j = 0; j < max; j++) {
39 System.out.println(j + ": " + times[j] / trials + "ms");
40 }
41 }
42
43}

Callers

nothing calls this directly

Calls 1

fibonacciMethod · 0.95

Tested by

no test coverage detected