Computes the nth Fibonacci number using a slow naive recursive strategy.
(int n)
| 24 | |
| 25 | /** Computes the nth Fibonacci number using a slow naive recursive strategy.*/ |
| 26 | private static int fib(int n) { |
| 27 | if (n < 0) { |
| 28 | return 0; |
| 29 | } |
| 30 | if (n == 1) { |
| 31 | return 1; |
| 32 | } |
| 33 | return fib(n - 1) + fib(n - 2); |
| 34 | } |
| 35 | |
| 36 | public static TimingData exampleFibonacciExperiment() { |
| 37 | List<Integer> Ns = new ArrayList<>(); |
no outgoing calls
no test coverage detected