3 ms·
Memoization and dynamic programming come together in top down DP algorithms. These are also referred to as recursion with memoization. The recursive function of
by spaghetti 14y ago
Memoization and dynamic programming come together in top down DP algorithms. These are also referred to as recursion with memoization. The recursive function often looks something like:
f(arguments) {
results = memoTable[arguments]
if(results) // use results
else
results = // expensive recursive call to f
memoTable[arguments] = results
}
- oskarkv 14y agoAs far as I have understood, this is just regular memoization. I mean, often in functional languages one just turns a regular function into a memoized version by calling memoize(function). Sometimes that works to create a function that does what your code does, and sometimes it does not. When it does not I think that's a shortcoming of the language/implementation.