Dynamic Programming
Dynamic Programming
Collection of overlaping sub-problems
Factors affecting DP
-
- Overlapping sub-problems
-
- Memorization [1-D Array]
-
- Tabulation [2-D Array]
Memorization
Here we have the computed values of sub-problems in an Array till n-1 sub problem and use that to calculate nth sub-problem.
Problems that use this : Fibonacci numbers, Longest Common Subsequence,
Tabulation
Here we have the computed values of sub-problems in a Matrix till (n x n-1) sub problem and use that to calculate (n x n)th sub-problem.