From d61684057ca7eaebf9a70c96c42ace429fdca54a Mon Sep 17 00:00:00 2001 From: marina <138340846+bt3gl-cryptographer@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:00:38 -0700 Subject: [PATCH] Update README.md --- dynamic_programming/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dynamic_programming/README.md b/dynamic_programming/README.md index eba53f8..dd27748 100644 --- a/dynamic_programming/README.md +++ b/dynamic_programming/README.md @@ -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. +
+ +```python +def fib(n): + if n <= 1: + return n + return fib(n - 1) + fib(n - 2) +``` + +
+ * there can be multiple places where the function may call itself. * any recursion problem can be solved iteratively and vice-versa.