I’ve read a great book recently. Algorithms Fourth Edition by Robert Sedgewick and Kevin Wayne. This is a great book that reminded me of my college days when I was listening to my Algorithms and Data Structures.

This book is written as a text-book, and is very technical. So if you’re looking for a light reading, this is definitely not it. It examines some of the most popular algorithms in use today in great detail, and it will help you understand them.

In the first section the authors will explain the basic programming model that will be used throughout the book, and they well explain how to calculate the complexity of algorithms. So called big O notation. Something that you’ll find very useful when discussing algorithms. It’s basically a cost model approximation, algorithm with a lower value will perform faster (e.g. O(n) is better than O(n2)).

In the second section you’ll learn a lot about sorting algorithms, with examples of the most popular ones. While reading this chapter I got curious and decided to experiment a bit. So I implemented most of these algorithms in swift, because I wanted to see how they performs compared to the standard array sort, you can read more about it here.

Next topic on the list is searching. We’re all pretty much using the standard linear search, so I wanted to see how much trouble it would be to implement one of these algorithms, and what would be the performance benefits from them. If you want to read a bit more about this, you can read one of my later blog posts where I talk about the binary search. Balanced search trees and hash tables is another interesting topic covered in this chapter that you might find interesting.

Fourth section was my favourite, it talks about graphing algorithms. I actually started reading the book from this section, because I wanted to solve a challenge on hackerrank.com, you can see the results of my attempts on the blog post about snakes and ladders. This section is probably the most extensive, and it contains a lot of graphing algorithms, more than any other section. All of them were a lot of fun to figure out, I’m sure you’ll enjoy it as much as I did.

Section five is all about strings, you’ll learn how to search wast arrays of strings in a fraction of the time. One example would be the Trie, a string search that utilises graphs to perform blazing fast searches. One typical use of a trie would be for autocomplete, for example. Another cool chapter is about regular expressions, where you will learn a great deal, enough to implement your own if you wanted to 🙂

The last chapter talks about real world usage for some of the algorithms covered in the book. It’s a bit less technical, but still very educational.

In the next few weeks I’ll explore some of these algorithms in more detail, and write a few more blog posts. All in all, this is a book every developer should have on his/her bookshelf. It’s very useful because it will help you understand software a lot better, and make you think of solving problems in another ways. I would definitely recommend you read it.

Have a nice day 🙂

Dejan.