Skip to content

Fibonacci corrections #10

Description

@dazza-codes

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions