Fix Fibonacci algorithm (#180)

This commit is contained in:
Tahir Rauf 2017-04-12 05:16:39 -07:00 committed by Donne Martin
parent ffd4798f23
commit 2c6982f154

View File

@ -64,7 +64,7 @@
"Recursive:\n", "Recursive:\n",
"* Fibonacci is as follows: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34...\n", "* Fibonacci is as follows: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34...\n",
"* If n = 0 or 1, return n\n", "* If n = 0 or 1, return n\n",
"* Else return fib(n-1) + fib(n+2)\n", "* Else return fib(n-1) + fib(n-2)\n",
"\n", "\n",
"Complexity:\n", "Complexity:\n",
"* Time: O(2^n) if recursive or iterative, O(n) if dynamic\n", "* Time: O(2^n) if recursive or iterative, O(n) if dynamic\n",