‘Algorithms to Live By,’ computer science for nonscientists

Despite its title, “Algorithms to Live By” by Brian Christian and Tom Griffiths (Holt, 2016) is not a self-help book. It is a truly fascinating look at what discoveries in computer science can tell us about efficiency and optimization, interspersed with humor and written to be accessible to nonscientists.

One of my personal favorites is the authors’ confirmation, backed by research on the search-sort tradeoff and caching theory, that the most efficient place to store the clothes you most often wear is beside your bed.

What studies of searching versus sorting tell us is that it is not generally worthwhile to spend a great deal of time organizing our belongings so that we will know exactly where to find them if we want them; we will expend much less time overall if we just search for what we want when we need it. Then caching theory tells us that we should cache nearby what we have most recently used, as that is what we are most likely to want to use again (evicting, as necessary, the least recently used item in order to make room).

Another issue Christian and Griffiths tackle is the parking problem — how to decide whether to pull into an empty spot or look for a closer one. Although I will not be putting this tip into practice any time soon, I was intrigued to discover that “the solution is to take the first empty spot less than -log 2/log(1 – p) spots from the destination, where p is the probability of any given space being available.” (That insight comes from the endnotes at the back of the book; I was so taken with the book that I read all 49 pages of endnotes.)

Fortunately, the research does have some less computationally challenging implications, such as the desirability of designing parking meters with variable charges based on current demand and laying out parking garages with a single prescribed route so that drivers pass by spaces of decreasing desirability.

A principle the book cites as having particularly wide-ranging implications is exponential Bacliff, developed to prevent simultaneous wireless signals from colliding over and over again as computers retransmit them in an effort to get them through. With exponential Bacliff, each signal is randomly retransmitted either one or two turns after the first failure, from one to four turns after the second failure, and so on. The authors point out a potential application to human relations — instead of giving that drug-addicted relative or probationer an undetermined finite number of chances and then abruptly giving up entirely, one might do better to require an exponentially increasing period of sobriety.

Along the way, the book introduces a number of Nobel prize winners and their ground-breaking discoveries. Also included are historical figures such as Thomas Bayes and Ben Franklin. Illustrating the chapter on what computer scientists call overfitting, in which too many factors are considered in a counterproductive effort to make the best possible decision, is a reproduction of a page from Charles Darwin’s 1838 diary in which he is considering whether to marry. He does conclude “Marry Q.E.D.,” but only after listing among the cons “having less money to spend on books.”

For surprising insights into what is and is not truly rational, definitely take a look at “Algorithms to Live By.”