# Explaining computer science algorithms/concepts/ideas using metaphors

Recently I found an interesting algorithm book entitled 'Explaining Algorithms Using Metaphors' (Google books) by Michal Forišek and Monika Steinová. "Good" metaphors help people understand and even visualize the abstract concepts and ideas behind algorithms.

For example,

One well-known exposition of the shortest path using the balls-and-strings model looks as follows: To find the shortest path between $s$ and $t$, one just grabs the corresponding two balls and tries to pull them apart.

My question:

I would like to see as many metaphors as possible for computer science algorithms/concepts/ideas.
Do you know any? Do you have your own ones?

• I think Knuth's The Art of Computer Programming has something about external sorting and snowploughs and elevators. – Zsbán Ambrus Mar 5 '15 at 14:06
• Stories can also be dangerous: it can be easier to try to make the facts fit the existing narrative, even when the story is no longer suitable and should be discarded. See also mathoverflow.net/q/2358/7252 for some mathematics examples. – András Salamon Mar 6 '15 at 9:09

B-Trees, N-ary Trees, Autocracy and Democracy

There is a very nice metaphor on decidable languages in the book Gödel, Escher, Bach by Douglas Hofstadter.

He uses drawings as an analogy for recursively enumerable languages. Every time you draw something on a sheet of paper, the part of the sheet that is not used by your drawing can be viewed as the "complement" of your drawing.

The artist M.C. Escher plays with such complements in pictures like this one:

We can view this as a picture of birds, whose complement is a picture of fishes.

The behaviour is the same with decidable languages: both the language and its complement are recursively enumerable.

To sum up, it allows to graphically view an object that "makes sense" (in this case it stands for recursively enumerable), such that the "hole" it leaves in the universe also "makes sense".

Water filling algorithm for channel allocation http://en.wikipedia.org/wiki/Water_filling_algorithm

Dijkstra's Algorithm and Human Psyche

http://rkvsraman.blogspot.in/2005/12/dijkstras-algorithm-and-human-psyche.html