Friday, November 25, 2016

Steven Skiena "The Algorithm Design Manual"

The modern typical programmer doesn't need to solve complicated algorithmic problems. Usually, you use fixed set of tools and methods that help you to manage the memory and the runtime of your program properly. Knowledge of the language matters, because you use data structures like the hash tables or linked lists almost every time, and, if you know how they work, you can achieve good runtime or memory economy, by using correct data structure. But very seldom you meet the problem, where you need to balance the tree in one way, instead of another, or solve complicated graph problem. The best way to apply the knowledge of algorithms for the average software developer is to go to a technical interview in a company like Google or Facebook. I wanted to read this book to update my skills of solving algorithmic problems and fill the whitespaces in my knowledge.

This book definitely requires a strong technical background. I knew a lot of data structures, represented in this book and some algorithms over this data structures, but even with this, it was very difficult to read it. The best way to use "The algorithm design manual" is to treat it like a course in your university. You need to take a pen and a paper and draw everything and try to reproduce the algorithms. Unfortunately, I read this book during my bus travels between office and home, so I didn't have such a possibility and didn't understand some things.

The best thing about this book is that it gives you the strong sense of how to develop the algorithms for a particular problem. It gives you the bunch of tools and says how to apply them. And the first thing that you need to do, when designing an algorithm is to model the problem in terms of existing problems. There are a bunch of existing already solved problems, and yours is definitely a special case. The second part of the book gives you a lot of problems that you can meet and, which is really important, gives you a set of questions that you need to ask yourself to understand in which direction to move further. It also gives you links to the implementations of the solutions, so you even don't need to reinvent the bicycle.

The proper way to optimize your algorithm is to use the correct data structure for some operations. The first part covers the majority of the data structures that you will need in solving algorithmic problems. It also gives simple implementation in C and set of tasks after every chapter. I guess, I need to reread this part more thoroughly because I still didn't understand some of the graph problems and I didn't solve the problems at the end of chapters.

In general, if you solve the algorithmic problems often, that book can be a bible for you. You can open it every time you need to solve something and read the correct approach. Otherwise, the best way for you is to read the first part and make sure that it is in your head, then make a fast screen of the second part. Then, open it again when you stuck and look for some help there.

If you want to start your journey in the algorithmic world, this will be a good book for you, but, it explains things very fast and sometimes skips the details, so you either need to prove things yourself or to find it in the other book. Better to read this book with some background, so you can recall some things and update your knowledge.