the simplest version of the problem Recursive case the result is computed based on a reduced version of the same problem n! {1 n × (n-1)! if n = 0 if n > 0
the simplest version of the problem Recursive case the result is computed based on a reduced version of the same problem n! {1 n × (n-1)! if n = 0 if n > 0 Base case Recursive case
invest $1000 at the beginning only, how much money do you get after n years of cumulating the interests? agg(n) {1000 agg(n-1) × 1.025 if n = 0 if n > 0 Base case Recursive case
+ fib(n-2) if n = 0 if n = 1 if n > 1 Base case Base case Recursive case Rabbits Newly born Total month 0 0 1 1 month 1 1 0 1 month 2 1 1 2 month 3 2 1 3 month 4 3 2 5 month 5 5 3 8 month 6 8 5 13
the same backward or forward. pal(s) ➡ True if the length of s is 0 or 1 ➡ False if the first and last characters do not match (assuming the length is greater than 1) ➡ pal(s’) otherwise, considering s’ the substring of s without the first and last character Base case Recursive case Base case “kayak” “emma”