Skip to content

Latest commit

 

History

History
35 lines (35 loc) · 1.16 KB

Chapter 8 - Recursion and Dynamic Programming.md

File metadata and controls

35 lines (35 loc) · 1.16 KB

0, 1, 1, 2, 3, 5, 8, ?


Fibonacci Numbers



Runtime of roughly O(2^n)


We should look for a way to optimize this.


Each time we compute fib (i), we should just cache this result and use it later.


This is exactly what DP is.



Greatest Common Divisor, GCD



Time to “Divide and Conquer"


Mathematical Thinking: Permutation and Combination

$$1x+2y+3x=N$$ 求 (x,y,z) 的非負整數解


Computational Thinking: Recursion and DP