Update README.md

This commit is contained in:
marina 2023-08-07 17:00:38 -07:00 committed by GitHub
parent e84d63ff68
commit d61684057c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,17 @@
* one or more base cases (a terminating scenario that does not use recursion to produce an answer)
* a set of rules, also known as a recurrence relation, that reduces all other cases towards the base case.
<br>
```python
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
```
<br>
* there can be multiple places where the function may call itself.
* any recursion problem can be solved iteratively and vice-versa.