An algorithm is a recipe: step-by-step rules for cooking something, transforming raw materials into a finished product. Data structures are the bins that hold flour, sugar, rice, baking soda, tea, spices, and other ingredients. Recipes are dynamic; they say what to do. Bins are static; they're just where things sit. We pay attention to creative chefs and overlook the carpenters who build the storage bins.

But there's a deep complementarity between the dynamic and the static, between algorithm and data structure — just as there is between time and space, energy and matter, momentum and position, current and charge, or magnetism and electricity. Depending on one's frame of reference, dynamic and static components can be transformed into each other. Clever data structures make algorithms simple, even trivial (e.g., precomputed look-up tables — analogous to precooked food from vending machines?). Clever algorithms make data structures simple (imagine food preparation starting with the elements of the periodic table!).

Using the trade-off between the dynamic and the static is a powerful mental tool for problem-solving. And more generally, dualism — recognition of the pairs of related, complementary entities, like yang and yin — is an even more powerful tool for understanding the world.

Thursday, December 02, 1999 at 06:09:54 (EST) = 1999-12-02

TopicProgramming - TopicThinking - TopicScience

(correlates: TwoFaces, DiffuseConsciousness, Periodic Tables, ...)