## Essential Algorithms - A Book Review

This post is a review (or possibly some long winded rambling) of the book Essential Algorithms: A Practical Approach to Computer Algorithms by Rod Stephens and published by Wiley.

Disclaimer: I received a copy of this book (with a personal signed inscription too :)) directly from Rod with the condition that I review the book. This has not influenced my review except that I have tried to do a decent job rather than just picking a star and saying I liked it.

## Quick overview

The book has quite a few chapters covering a pretty good selection of algorithms, including

- Numerical Algorithms
- Linked Lists, Arrays, Stacks and Queues, Hash Tables
- Sorting
- Searching
- Recursion
- Trees, Balanced Trees, Decision Trees
- Basic Network Algorithms, More Network Algorithms
- String Algorithms
- Cryptography
- Complexity Theory
- Distributed Algorithms

There's also a glossary as you would expect with this sort of reference, and an appendix with the answers to all the practice questions - you will need this!

Each chapter is divided into sections, and ends with a summary
and a set of practice questions, some of which are marked with
one or more `*`

to indicate a tougher problems. Standard stuff!

There's also sample code available from the book's website.

## Tell me about the book already

I don't have a very strong maths background, and there is a distinct lack of material on either mathematics or algorithms to be found in my selection of programming books. I do have one other book on the subject of algorithms/data structures - it is so dry and filled with source code in an unfamiliar language I haven't even attempted to read it yet.

Essential Algorithms on the other hand, is a book I found to be very approachable, bar a hiccup or two.

When I buy computer books, they are pretty much always for a
specific language or technology, but I think Essential
Algorithms is actually language agnostic. While the accompanying
downloadable source is in C#, the code in the book is pseudo
code written as plain English (or perhaps Rod's version of
Beginners All-purpose Symbo... *cough*). I actually found this
refreshing as when trying to grasp a tenet of the algorithms Rod
was describing I didn't have to "think code" which is more
helpful than it sounds.

## My head!

So I mentioned hiccups. What were these? Well, my initial foray into the book was slightly bewildering. The very first chapter, describes various performance characteristics (Big O notation) and chapter two dives right into numerical algorithms. This second chapter actually covers quite a lot, but I did find it difficult to grasp. I don't find fault with Rod's writing for this, but my lack of knowledge on mathematics. With that said, it looked interesting enough that I am determined to get enough knowledge to be able to read this chapter and understand it!

## When is an algorithm not an algorithm

Chapters three through five cover linked lists, arrays, stacks and queues, something I suspect any C# developer would recognise. Even though I'm intimately familiar with these data structures, and, (with the exception of linked lists) use them regularly, I still discovered quite a few new things I hadn't considered regarding implementation and advanced usage of such structures, which never occurred to me when using black box implementations.

An example of this is sentinel values to avoid having to write code to handle special cases (such as the start or end of a linked list). Seems obvious but I hadn't thought of it - assuming I was aware of the special case I'd write extra code to handle it.

## Sorting and Searching

I suppose every programmer can write a bubble sort without even thinking about it, but Essential Algorithms covers no less than 8 different ways of performing a sort.

Closely tied to sorting is searching, as it is more efficient to search sorted data. Oddly however, this is an incredibly short chapter - barely 6 pages. However, it does include binary and interpolation search algorithms which are much better than the usual linear search that I would normally do.

With that said, the book then follows on with a detailed chapter on hash tables which can also help you find data extremely fast.

## Seeing the forest for the trees

Many people are familiar with a tree as a means of presenting hierarchical data, but that's not what the chapters on trees cover. Essential Algorithms describes binary trees, complete trees, sorted trees, how to traverse trees, how to search trees, expression evaluation, the list goes on.

I found this chapter engrossing as I could dimly see the light bulb flickering of how I could make use of these techniques.

This is then followed by a chapter on balanced trees (AVL trees and b-trees). I started getting a bit lost here, although it didn't help due to my schedule I was reading through the last chapters very piecemeal, a few pages here, a page or two there. While I started to get glimmers of ideas from the first two chapters on trees, the 3rd tree chapter - Decision Trees - was another head scratcher.

## Networks are trees with added epic

There are two chapters which deal with networks. As with the first couple of tree chapters, I also found these chapters quite interesting, with the caveat I couldn't immediately see how I can use this knowledge in my code. They cover network traversal, short path detection, map colouring (whoever would believe that automatically colouring a map in as few shades as possible would be so hard!) and a bit more besides.

## My head is hurting again

The last few chapters deal with cryptology (interesting, but there's no way I'm going to try reinventing that wheel, I'll use managed black box classes!), complexity theory (I gave up trying to understand it) and distributed algorithms, which falls neatly under the parallel processing banner and so again should be somewhat familiar to C# developers. I wondered why this was the last chapter as the complexity theory was so complicated it should have been at the end.

## Sample Code

I haven't tried most of the exercises offered at the end of each chapter, so I can't comment on the accuracy of these. And, as I haven't finished them I've avoided looking in detail at the source code examples. The ones I have browsed don't seem to be bad, and while are not extensively commented (so you'll probably have to have the book to hand for reference), they do include enough comments for you to know what's going on, and the code itself is not written in an obtuse fashion. Even from the brief look I'd taken I could see things I could learn from so yet more bonus.

## In conclusion

Unlike many programming books I have bought in the past, Essential Algorithms is actually a book that I want to read again, both to pick up what eluded me the first time around, and to help me visualize ways of using what I have learned in the code I write.

However, if like me you don't have a strong head for maths, you might struggle with some of the chapters.

## Update History

- 2015-03-07 - First published
- 2020-11-21 - Updated formatting

## Leave a Comment

While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

## Comments

## Dan

#

I just picked up a copy at Microcenter over the weekend. This is great!

Is it insulting or unfair to call this "Knuth for Dummies?" It's all so... accessible! It's already given me answers for problems I've been struggling with for months.

I even like the way it's typeset and bound; these things are not unimportant.

## Richard Moss

#

Hello,

I don't know directly as I haven't read any of his works, but I somewhat dislike the "Dummies" series... seems awfully daft to me to call your customers idiots :) But it is a good book!

You are correct regarding the typesetting, I shall take a note of that for next next review.

Thanks for the comment!

Regards; Richard Moss

## Dan

#

I have an aversion to the Dummies series as well, but it's just a name. There's another series "Idiot's Guide to..." on many subjects; I'm not musically inclined and the author of "Idiot's Guide to Music Theory" really brought everything "down" to my level. (I admit I was desperate to grasp certain musical topics!)

Donald Knuth is a computer scientist who has written a series called "The Art of Computer Programming," of which there are several volumes. Everything is broken down to essential maths, code examples are written in an assembly language for a theoretical processor, I/O is presented in the form of punch cards... and it's all still relevant... I'm just not literate enough to make sense of what I read. Some folks state things low-level and universal. Some folks state things high-level, colloquial and accessible; this is what I need :) Despite this, I pull Knuth's book off the shelf

afterI feel like I've learned something just to review that low-level, universal, mathematical perspective.Another great example is Simon Peyton Jones' TED talk on the British education system's focus on teaching computer science to young children. They teach middle-schoolers the quicksort by acting it out as a group! Brilliant! Trying to learn that in Pascal in high-school was... difficult. There's nothing complicated about algorithms, I just had the wrong book.

## Luke

#

thanks for review, will buy book