Added section on Tabulation vs Memoization (#28093)

pull/33092/head^2
Aaron Fox 2019-04-16 13:27:15 -04:00 committed by Randell Dawson
parent 52b06a1ec0
commit e658f50679
1 changed files with 4 additions and 0 deletions

View File

@ -46,6 +46,10 @@ def fib(n)
```
Caching computed solutions in a lookup table, and querying it before going for recursion will let the program have a running time of O(N).
#### Tabulation vs Memoization
In addition to *memoization* (used in the previous example), there is also *tabulation*, which uses a bottom-up approach rather than memoization's top-down approach. Tabulation always tabulates every potential value, while memoization only calculates, or memoizes, the needed values. Tabulation avoids any recursion, however, so both are useful for different situations. Read more about tabulation vs. memoization [here](https://www.geeksforgeeks.org/tabulation-vs-memoizatation/).
#### More Information:
[What is dynamic programming on StackOverflow](https://stackoverflow.com/questions/1065433/what-is-dynamic-programming")