Memoization

Uncategorized

I’ve been spending some time learning about different languages and paradigms, which introduces me to terminology I’ve never heard before. I am not a “classically trained” computer science major – my programming and design skills are mostly self-taught. When I was staying mostly in my own space (building line of business applications in .Net, and VB (and some dBase) before that) I did not get exposed to any of this crazy terminology.

So, mostly as notes to myself, I am writing down what these terms I keep hearing mean (in my own words), instead of just glossing over them in my head and hoping the rest of the context clues will keep me going. If you get any value from this, great! 🙂

Memoization is a term I keep hearing in the various functional programming/distributed systems videos I’ve been watching. I figured it has something to do with remembering things and not put too much more thought into it. And, indeed, it does have to do with “remembering”, but a fairly specific case of it.

Memoization is keeping the results of past computations so that you can refer to them again without having to take the time to do the computation. It shows up often in recursive solutions. Basically, if you have a deterministic (a word I do know, since I did study a good amount of statistics WAY back in college) function, you can store the result in a dictionary keyed with the input value(s) (or a hash of them), and just use it in the future instead of recalculating.

Advertisement