Algorithms and Data structures books: One size doesn't fit them all
Over the years running this moderately popular website, I have been asked many times what is the best book
about Algorithms and Data Structures. The answer is always "It depends" !
It depends on how the programmer's brain works and what kind of notation he is comfortable with.
There are many flavors of mindset out there but it usually comes down to two metrics :
- Mathematics
- Illustrations
Here are five good books that rank differently on those metrics and will fit different preferences :
- The Algorithm Design Manual by Steven S Skiena.
- The Art of Computer Programming by Donald E. Knuth.
- Programming Interviews Exposed by John Mongan, Noah Kindler and Eric Giguere.
- Algorithms by Robert Sedgewick and Kevin Wayne.
- Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein.
About Mathematics
If the importance of good illustrations is obvious, here is more insight about the mathematic metric:
I first noticed it while reading Real-time Shadows.
Near the beginning of the ouvrage, readers would come across the following line:
(p,q) := { r | r := p + α ( q - p) , 0 < α < 1 } *
The author must have felt bad about it because they included a footnote :
* This says that the segment (p,q) consists of all points r that between p and q.
The footnote was raising the question: When should we describe something with mathematics instead of words ?
When is is better for the reader ? There is no absolute answer because some people prefer the mathematic form while others prefer the English
form.
Trivia : Here is the page in question just for reference.
Over the years I have found that there are two kinds of programmers :
- Those that can use mathematics notation.
- Those that are confused and furthermore discouraged by mathematic notation.
I used to attribute dislike of mathematics to laziness but I changed my mind: Some people have different brains and respond differently to "mathematicness". Try to learn yourself and acknowledge how your brain likes to have things explained.
Programming Interviews Exposed
Programming Interviews Exposed is a slim book that can be read within a few hours. No mathematic notation and few drawing:It doesn't cover a lot but provides enough to look good during an interview.
Algorithms
Algorithms 4th edition is a Masterpiece. It covers many topic, features many drawings, no mathematics notation and variable traces to help follow each algorithms chronology.
Each A&D are progressively introduced with increasing complexity.
The Algorithm Design Manual
The Algorithm Design Manual is the Masterpiece from the other side: With a fair amount of mathematical notation and few illustations. Skiena war-stories are amazing and so is the HitchHiker's Guide.
Introduction to Algorithms
Often used in universities (and French Engineer School), It is the cold extensively covered truth with heavy mathematics
and rare old looking drawings.
The Art of Computer Programming
The legendary TAOCP take things to an other level: All references use a mythical machine invented for the book: The polyunsaturated computer MIX. Heavy on math. Few drawings. Gorgeous but also bad for self-esteem.