REVIEW - Learning Algorithms - A Programmer's Guide to Writing Better Code


Title:

Learning Algorithms

A Programmer's Guide to Writing Better Code

Author:

George Heineman

Publisher:

O’Reilly Media (2021)

Pages:

350

Reviewer:

Simon Sebright

Reviewed:

January 2022

Rating:

★★★★☆


Recommended

This book is aimed at programmers who want to get to grips with the basics of algorithms useful in computing – to find out what they do, how they work, how to choose the most appropriate one. It is not intended to be a deeply theoretical mathematical work, rather a practical guide, showing how a range of standard algorithms are designed and can be programmed, in this case using Python code examples.

The first chapter introduces us to the big O notation, starting with some simple algorithms, seeing what it means to be O(1), O(N), O(NlogN), etc. These are shown with some code examples and comprehensive performance measurements over a range of input data sizes. From this, we learn what to look for in an algorithm’s code, to be able to determine its performance characteristics with respect the input data size.

Then the book proceeds chapter-by-chapter to introduce new data structures and typical algorithms which these are used with. I found that the book could have been called Learning Algorithms and their Data Structures or similar, because the design of the data structures goes a long way to the actual implementation of the algorithms. Typical code libraries might provide these structures and algorithms together, but the book uses its own code mostly to show how the structures are created and how the algorithms work. One exception in the last chapter is the import of a Python graph library to model graphs, but the algorithms are shown as actual code examples.

Example topics include sorting, searching, trees, queueing (FIFO, first in/first out, priority queues), stacks (LIFO, last in/first out) and graphs.

Each chapter has a set of ‘challenging exercises’ at the end. I didn’t try any of these, but they looked interesting if I had wanted to get my hands dirty.

I found the explanations and code samples easy to follow, even though I have never programmed in Python. I must admit I did not try download the accompanying code. Mostly they are not more than half a page long and clearly explained afterwards with a line-by-line description of what is going on.

I gave the book a recommended review, as I think for the target audience it’s great start to this topic. It certainly is not trivial, as I realized when I wasn’t able to concentrate that well, I had to re-read. On the other hand, the material is not too complex to be overwhelming and topics are gradually introduced and go into the complexity bit-by-bit.

Whilst most people will not be inventing new fancy algorithms every day, and will hopefully using library versions rather than writing their own versions of functions, I think a good basic understanding of these is important, in order to identify the right approach given your given requirements, input data sizes, performance limitations, etc.

Website: https://www.oreilly.com/library/view/learning-algorithms/9781492091059/






Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.