Algorithms

Author: Panos Louridas
Publisher: MIT Press
Date: August 2020
Pages: 312
ISBN: 978-0262539029
Print: 0262539020
Kindle:  B084V86BXM
Audience: General
Rating: 4
Reviewer: Mike James
Algorithms - big subject, smallish book!

This is an introduction to algorithms for the general reader. In this case I'm not sure who the "general" reader is and getting the audience right is a big part in evaluating this book. Of course, every programmer knows that algorithms are important but what about the general reader? What do algorithms mean to you if you are not a general reader? This book presents ideas that are accessible to the non-programmer but its selection of algorithms target the programmer.

Chapter 1 is probably the least programmer-oriented as it introduces the Euclidean algorithm for finding the greatest common divisor (GCD) of two integers. This isn't an algorithm that most programmers have in their heads, but it is often used in academic courses. The problem with it is finding a motivation for introducing it because finding the GCD of two integers doesn't crop up very often in important problems and when it does there is often a function in a library that solves it for you. Panos Louridas does a good job of motivating the task by showing how the patterns involved in the algorithm correspond to musical rhythms.  I have to admit that I wasn't convinced.

I also found the way the algorithm was presented was almost insightful, but not quite. I have had time for the Euclidean algorithm to sink in and I still don't get it at a deep level. That it works isn't in question, but I don't really see what it is doing with the numbers. Reading Chapter 1 didn't really help me get there, but it came tantalizingly close and I will certainly carry on thinking about it. I could well be too demanding and perhaps I will get it eventually, but overall I think the idea that the GCD of a and b is the largest square tiling of the a by b rectangle might get me there quicker than rhythms.

Banner

Chapter 2 moves into a rich area of problems that are easy to state and difficult to solve - graphs. The idea of complexity was introduced in the first chapter and it is applied here to reveal some of the difficulties. It starts off with another classic problem -  the Seven Bridges of Königsberg - which was solved by Euler in 1736. It seems to be a practical problem but surely only a mathematician would be tempted to seek a tour that crossed each bridge only once? A programmer, a true algorithm-phile, would be more interested in shortest distance or some other more useful optimization. It doesn't matter because graph theory is the correct way to present many practical problems and its algorithms are many and varied. We meet Dijksta's algorithm,  scheduling a tournament, and some others on the way to the next chapter - searching.

 

Of course, searching is an area, together with sorting, where most of our best known classical algorithms live. This account, however, isn't purely classical as it includes the secretary problem, which is really a statistical problem rather than a pure algorithm. You can argue that algorithms are never pure and, yes, this is a good example. The next chapter deals with the other side of the coin - sorting. Here we meet Insertion Sort and Merge Sort. The acid test is does it include Quicksort and the answer is yes. Not only does it include Quicksort, it is a really good explanation that is understandable even if you aren't a programmer.

The final two chapters are far from classical. Chapter 5 is about PageRank, which was an important algorithm but now things aren't so clear cut. Chapter 6 is about Deep Learning, which arguably is another of those algorithms that are really about mathematics. If an algorithm simply implements some piece of math is it really worthy of consideration as an algorithm in its own right? Given the book started out with the Euclidean algorithm this seems to be an answered question, but there is something different about deep learning. Of course they are all algorithms, but there is something  of a different nature about sorting and searching than in the case of deep learning.

Conclusion 

This is a good book and I very much enjoyed reading it. My only reservation is that the algorithms are presented in as interesting and as motivating a way as possible, but I'm not sure that the general reader is going to go "oh gosh - I never knew that!!" I'm not sure that there is enough excitement to capture the imagination of a reader who isn't already convinced that algorithms are interesting. No mention of hashing, the traveling salesman problem, the A* algorithm, spigot algorithms for Pi, public key cryptography, prime testing and so on... all arguably more exciting in their application.

This would make a good present for a beginning programmer looking for an easy to read way into algorithms. For the general, initially disinterested, reader I'm not so sure. 

 

  •  Mike James is the author of The Programmer’s Guide To Theory which as its subtitle "Great ideas explained" suggests, sets out to present the fundamental ideas of computer science, including some algorithms, in an informal and yet informative way.

 

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Grokking Machine Learning

Author: Luis G. Serrano
Publisher: Manning
Date: December 2021
Pages: 512
ISBN: 978-1617295911
Print: 1617295914
Kindle: B09LK7KBSL
Audience: Python developers interested in machine learning
Rating: 5
Reviewer: Mike James
Another book on machine learning - surely we have enough by now?



Object-Oriented Python

Author: Irv Kalb
Publisher: No Starch Press
Date: January 2022
Pages: 416
ISBN: 978-1718502062
Print: 1718502060
Kindle: ‎ B0957SHYQL
Audience: Python developers
Rating: 3
Reviewer: Mike James
Python, Object-Oriented? Not a lot of programmers know that!


More Reviews

Last Updated ( Tuesday, 17 November 2020 )