Timing Code Execution in Java

Here’s a method for calculating the nth Fibonacci number, written in Java. static int fibN(int n) { if(n <= 1) { return n; } else { return fibN(n-1) + fibN(n-2); } } This method is great for demonstrating recursion but it’s terribly inefficient for the task at hand. A more… Continue reading