|
Walh Hara posted:Ha, fair point, my example is wrong (but my claim that there are ways to calculate fibonacci in linear time is not). Either way I was just pointing out that when people say "solve fibo with recursion" you do not necessarily have to answer with fibo(n) = fibo(n-1) + fibo(n-2). Whether you use recursion or iteration shouldn't really change the time complexity (big O) of the optimal solution of any problem if you know what you're doing. your example is iterative
|
# ¿ Apr 16, 2016 21:51 |
|
|
# ¿ May 10, 2024 00:16 |