Oran Looney personal blog
A Fairly Fast Fibonacci Function
A common example of recursion is the function to calculate the $n$-th Fibonacci number: def naive_fib(n): if n < 2: return n else: return naive_fib(n-1) + naive_fib(n-2) This follows the mathematical definition very closely but it’s performance is terrible: roughly $\mathcal{O}(2^n)$. This is commonly patched up with…
- Points
- 131
- HN comments
- 58
- Submissions
- 1
- Cited by
- 0 commenters
Math & AlgorithmsSoftware Engineering2019
On Hacker News
| Submitted | Title on HN | Points | Comments |
|---|---|---|---|
| Feb 21, 2019 | A Fairly Fast Fibonacci Function by olooney | 131 | 58 |