Fibonacci
Iterative: O(n)
Single for loop
Recursive: O(2^n)
Creates 2^n (b^n where b is the number of child branches) calls to the stack at time, since the recursive call continues traversing until it reaches the base case.
Last updated
Was this helpful?