Created
July 15, 2019 19:08
-
-
Save YannMjl/bae3cb9ee74b85ecb26c1feaf92f0b9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // recursive calculation of Fibonacci numbers | |
| function fibonacci(number) { | |
| if (number <= 1) return number; | |
| return fibonacci(number - 2) + fibonacci(number - 1); | |
| } | |
| console.log(fibonacci(5)); | |
| console.log(fibonacci(6)); | |
| console.log(fibonacci(7)); | |
| // ********************************************************************************** | |
| // - In this case the run time of readArrayOfArray is quadratic: O(2^N) | |
| // ********************************************************************************** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment