# Programs = Data Structures + Algorithms [closed]

Niklaus Wirth wrote a book that popularised the informal equation used as a title: “Data Structures + Algorithms = Programs”. I like to write this equation backwards as in the title of the question, because it hints at a simple but subtle aspect of programming: we are responsible of deciding which ideas of our programs we want to express by data structures and which we want to express with algorithms.

Is there any hint in the book by Niklaus Wirth that he subscribes to or even expresses this view, or is this free interpretation of the informal equation a mere coincidence?

A classical example would be useful to clarify this point. When we implement a finite state automaton we could represent the state using mutually recursive functions – therefore making the state implicit in our program and giving more weight to the “algorithm” part of our program – or using an explicit variable holding the state – thus arbitraging in favour of data structures. In more advanced example, this choice has sometimes a direct incidence on the maintainability or extensibility of programs.

• I haven't the slightest idea what you're asking. However, I can tell you this: in a meaningful computing context, algorithms are worthless without data to process, and raw data is useless without algorithms to process it. So the notion that you might do one without the other seems incomprehensible to me. Commented Mar 17, 2016 at 17:54
• state and structure are not the same thing. Commented Mar 17, 2016 at 18:16
• I do not think I stated anywhere I would like to rely solely on the one or the other! When implementing a program there is a lot of choices to do about which ideas to represent as data and which to represent as code, and often enough one can move one aspect of the program from the code part to the data part. The question is about Wirth expression this view in his book or not. Commented Mar 17, 2016 at 18:20
• Can you give an example where you would have to choose between an algorithm and a data structure? Commented Mar 17, 2016 at 19:22