Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fibonacci corrections #10

Open
dazza-codes opened this issue Jul 2, 2018 · 2 comments
Open

Fibonacci corrections #10

dazza-codes opened this issue Jul 2, 2018 · 2 comments

Comments

@dazza-codes
Copy link

dazza-codes commented Jul 2, 2018

In https://github.com/jmportilla/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Recursion/Recursion%20Interview%20Problems/Recursion%20Problems/Recursion%20Problem%203%20-%20Fibonacci%20Sequence.ipynb

The results for the Nth number in the sequence are not clear, unless the start of the sequence begins with the Nth number of 0, i.e.

N=0, 0
N=1, 1
N=2, 1
N=3, 2
N=4, 3
N=5, 5
N=6, 8
N=7, 13
N=8, 21
N=9, 34
N=10, 55
etc.

The description seems to confuse the Fibonacci sequence with a factorial sequence, when it says:

Remember that a fibonacci sequence: 0,1,1,2,3,5,8,13,21,... starts off with a
base case checking to see if n = 0 or 1, then it returns 1.

Else it returns fib(n-1)+fib(n+2).

This should read:

Remember that a Fibonacci sequence: 0,1,1,2,3,5,8,13,21,... starts off with a
base case checking to see if n = 0 or 1, then it returns n, 
else it returns fib(n-1) + fib(n-2).
  • if n = 0 or 1, then it returns n (not 1)
  • there is a typo in fib(n-1)+fib(n+2), it should be fib(n-1)+fib(n-2).

Hope this is right and helps to make a correction.

PS, thanks for a great course

@dazza-codes
Copy link
Author

@jmportilla - there is a PR to fix this in #14; it has a merge conflict but the change is not very complex and could be fixed on a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant