Memoization vs Tabulation
- Memoization
- Memoization is called as dp(n,...) where n is the given large value
- it also has a base case which
return
a particular small valueit goes from
dp(n,..)
->dp(n-1,..)
->dp(n-2)
i.e. goes on decreasing
- Tabulation
Tabulation uses for loop from
(1 -> n)
or sometimes(O -> n)
- here, we need to initialize some cells of the DP table
tab[]
with known initial values (thebase cases
).
- here, we need to initialize some cells of the DP table