mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update README.md
This commit is contained in:
parent
e84d63ff68
commit
d61684057c
@ -23,6 +23,17 @@
|
|||||||
* one or more base cases (a terminating scenario that does not use recursion to produce an answer)
|
* 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.
|
* 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.
|
* there can be multiple places where the function may call itself.
|
||||||
|
|
||||||
* any recursion problem can be solved iteratively and vice-versa.
|
* any recursion problem can be solved iteratively and vice-versa.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user