I ended up with probably not a best solution, but here is what i've got(may be it will help someone in future):
1) I measured the time, which the recursive method needs to calculate the 42-nd(for example) Fibonacci number.
2) Using the iterative method, I counted how many program rows are executed while calculating the 42-nd Fibonacci number with the recursive method. (Rows = 3*fib_iterative(42)-2)
3) Deviding 2. by 1. I got the average number of rows executed in 1 millisecond.
4) Using the iterative method, I counted how many program rows are executed while calculating the 400-th Fibonacci number with the recursive method. (Rows = 3*fib_iterative(400)-2)
5) Deviding 4. by 3. I got the estimated time spent by fib_recursive(400).
// Recursive algorithm, calculates Fibonacci number (slow)
private static double fib_recursive(int n){
if( n <= 2) return 1;
else return fib_recursive(n-1) + fib_recursive(n-2);
}
// Iterative algorithm, calculates Fibonacci number (fast)
private static double fib_iterative(int n){
double a = 1, b = 1;
for (int i = 2; i <= n; i++){
b = a + b;
a = b - a;
}
return a;
}
// Get time, which fib_recursive(int) needs to calculate the 400th Fibonacci number
private static long testRecursiveFor400(){
int elapsedTime = 0;
int start = (int) System.currentTimeMillis();
fib_recursive(42);
elapsedTime = (int) (System.currentTimeMillis() - start);
return (3 * (long) fib_iterative(400) - 2) / ((3 * (int) fib_iterative(42) - 2) / elapsedTime);
}