Recursion. Breaking down problems into solvable subproblems Chapter 7. The good and the bad. Pluses Code easy to understand May give different view of problem Sometimes, efficient Bad overhead of functions calls (20-30%) may be hard to analyze cost not apparent
Breaking down problems into
m^k at depth k
Nodes in a Sk+1 trees is
# in Sk tree + m*number of leaves in Sk
= (mk+1-1)/(m-1) +m*mk
= (mk+1-1)/(m-1) + m^(k+2)/(m-1) -m^(k+1)/(m-1)
= (m^(k+2) -1)/(m-1)
if (n <= 1) return 1
else return fib(n-1)+ fib(n-2)
# of permutations of those invited is k!
# of permutations of those not invited is (n-k)!
Down: extend matching by deleting char si
Right: extend match by deleting char tj
Diagonal: extend match by substitution, if necessary