Lecture Notes for SE 598, Data Structures and Algorithms
9 August 2000, Map and Multimap Algorithms
- memoization - remembering what's been done before
- when computing f(x1, x2, ..., xn), remember
v, the value computed
- store v in a memo map using some combination of x1, x2, ..., xn as a key
- before computing f(x1, x2, ..., xn), look in
the memo map to see if it's been computed before
- saves time on expensive, re-occurring computations
- f() must be a function - produce the same value from the same
arguments every time
- software caching - more general than memoization, more reliant on hashing
- when retrieving a value, store a copy of in the cache
- caches are fast, simple, and near-by, while the values may be far,
slow, or difficult to get
- maps ensure that caches are fast and efficient to modify and search
- stl maps have unfortunate semantics
- networking makes heavy use of software caches - information is far away
and difficult to get
- the stale-date problem with caches
This page last modified on 9 August 2000.