Skip to main content

Once upon and Algorithm - Martin Erwig ***

I've been itching to start reading this book for some time, as the premise was so intriguing - to inform the reader about computer science and algorithms using stories as analogies to understand the process.

This is exactly what Martin Erwig does, starting (as the cover suggests) with Hansel and Gretel, and then bringing in Sherlock Holmes (and particularly The Hound of the Baskervilles), Indiana Jones, the song 'Over the Rainbow' (more on that in a moment), Groundhog Day, Back to the Future and Harry Potter.

The idea is to show how some aspect of the story - in the case of Hansel and Gretel, laying a trail of stones/breadcrumbs, then attempting to follow them home - can be seen as a kind of algorithm or computation and gradually adding in computing standards, such as searching, queues and lists, loops, recursion and more.

This really would have been a brilliant book if Erwig had got himself a co-author who knew how to write for the public, but sadly the style is mostly heavy academic, so the cleverness is rather wasted. Sometimes this comes across in labouring points and at others in spending a lot of effort on what is little more than defining labels for things, rather than providing useful information and context for the reader. It's not that there's not a lot of good material in there, just that it's hard work to dig it out, where I'm sure the whole idea of using the stories was to make it more approachable.

Part of the problem is that the stories themselves don't always work very well as an analogy for what's happening in the computation. So, for example, in the section dealing with sorting he comes up with the task of sorting the tasks and places that Indiana Jones needs to deal with to find the Lost Ark. The unsorted list includes the likes of: disc, sunbeam, Marion and Nepal. The algorithm used involves finding the 'smallest' element... which somehow we are supposed to instantly see is Nepal. Using numbers would not have been so well-linked to the story, but at least it would have made some sense to the reader.

Perhaps the low point is the section that uses a part of the song 'Over the Rainbow' (giving us a tenuous story connection to The Wizard of Oz) to examine language and meaning. If you aren't familiar with musical notation, I'm not sure it's a very helpful analogy... and if you are, some of the ways it's used (particular the assertion of what bars are for) doesn't entirely make sense.

I was a professional programmer for a number of years, but without a computer science background. So I was very familiar with how to do this stuff, but knew nothing of the theory behind it. As such, I found the content of the book really interesting - and the story idea should have made it doubly brilliant - but the execution meant that it didn't deliver anywhere near as well as it could have. Even so, there's a lot to savour, and it's definitely worth persevering to get a feel for why computer programs involve far more than just 'cutting code.'


Hardback:  

Kindle:  

Using these links earns us commission at no cost to you

Review by Brian Clegg

Comments

Popular posts from this blog

God: the Science, the Evidence - Michel-Yves Bolloré and Olivier Bonnassies ***

This is, to say the least, an oddity, but a fascinating one. A translation of a French bestseller, it aims to put forward an examination of the scientific evidence for the existence of a deity… and various other things, as this is a very oddly structured book (more on that in a moment). In The God Delusion , Richard Dawkins suggested that we should treat the existence of God as a scientific claim, which is exactly what the authors do reasonably well in the main part of the book. They argue that three pieces of scientific evidence in particular are supportive of the existence of a (generic) creator of the universe. These are that the universe had a beginning, the fine tuning of natural constants and the unlikeliness of life.  To support their evidence, Bolloré and Bonnassies give a reasonable introduction to thermodynamics and cosmology. They suggest that the expected heat death of the universe implies a beginning (for good thermodynamic reasons), and rightly give the impression tha...

Humble Pi - Matt Parker ****

Matt Parker had me thoroughly enjoying this collection of situations where maths and numbers go wrong in everyday life. I think the book's title is a little weak - 'Humble Pi' doesn't really convey what it's about, but that subtitle 'a comedy of maths errors' is far more informative. With his delightful conversational style, honed in his stand-up maths shows, it feels as if Parker is a friend down the pub, relating the story of some technical disaster driven by maths and computing, or regaling us with a numerical cock-up. These range from the spectacular - wobbling and collapsing bridges, for example - to the small but beautifully formed, such as Excel's rounding errors. Sometimes it's Parker's little asides that are particularly attractive. I loved his rant on why phone numbers aren't numbers at all (would it be meaningful for someone to ask you what half your phone number is?). We discover the trials and tribulations of getting cal...

Quantum 2.0 - Paul Davies ****

Unlike the general theory of relativity or cosmology, quantum physics is an aspect of physics that has had a huge impact on everyday lives, particularly through the deployment of electronics, but also, for example, where superconductivity has led to practical applications. But when Paul Davies is talking about version 2.0, he is specifically describing quantum information, where quantum particles and systems are used in information technology. This obviously includes quantum computers, but Davies also brings in, for example, the potential for quantum AI technology. Quantum computers have been discussed for decades - algorithms had already been written for them as early as the 1990s - but it's only now that they are starting to become usable devices, not at the personal level but in servers. In his usual approachable style, Davies gives us four chapters bringing us up to speed on quantum basics, but then brings in quantum computing. After this we don't get solid quantum informat...