A good way to structure many computer programs is to store the key information you currently know in some data structure and then have each iteration of the main loop take a step towards your destination by making a simple change to this data.
- 1 Iterative Algorithms: Measures of Progress and Loop Invariants
- from How to Think About Algorithms
- Publisher: Cambridge University Press
- Released: May 2008
design a data structure that's a minimal version of final output, and design the process so that each loop increases the structure towards final output.
Share this highlighthttp://www.safaribooksonline.com/a/how-to-think/3326087/