4 ms·
So, it's just caching the return values of the method calls? I thought applying dynamic programming to fibonacci numbers was algo 101? And what is -O7 level? O
by smarx007 10y ago
So, it's just caching the return values of the method calls? I thought applying dynamic programming to fibonacci numbers was algo 101?
And what is -O7 level? Or, better, O7 lvl? :) Dynamic version of 45th fibonacci number (see http://www.geeksforgeeks.org/program-for-nth-fibonacci-number/ http://www.geeksforgeeks.org/program-for-nth-fibonacci-numbe...) has the following runtime:
ᐅ gcc -O2 fib.c -o fib && time ./fib
1134903170
./fib 0.00s user 0.00s system 49% cpu 0.005 total