Tuesday, January 08, 2019

Use Optimal Data Structures

Data structures & algorithms are intimately interrelated. (Jerry Yoakum)

The structure of data and the structure of programs manipulating that data are intimately interrelated. If you select the right data structures, your algorithms (and thus your code) become easy to write, and easy to read, and therefore easy to maintain. Read any book on algorithms or on data structures (they're one and the same!).
    When preparing to write a program, you should develop the algorithms and data structures together. Try two or three or more different pairs before you select the best one. And be sure to encapsulate the data structure in one component so that, when you later find a better structure, you can change it easily.


Reference:
Kernighan, B., and Plauger, P., The Elements of Programming Style, New York: McGraw-Hill, 1988.