views:

6665

answers:

21

I know what algorithms are, but I have never consciously used or created one for any of the programming that I have done. So I'd like to get a book about the subject - I'd prefer if it was in python but that's not a strict requirement. What book about algorithms helped you most to understand, use, and create algorithms?

One book per answer so they can be voted on...

+33  A: 

My top general recommendation would be Introduction to Algorithms by Cormen, Leiserson, and Rivest. However, the books I've found most useful were more specialized. That is, it depends on what problem you want to learn algorithms for.

John D. Cook
I love this book for its implementations in pseudocode. You can easily translate them into just about any imperative programming language.
Barry Brown
This book will require years to complete. I also dislike it for lack of parallel algorithms.
psihodelia
+11  A: 

Algorithm Design Manual by Steven Skiena. (Second edition recently released.)

David Grant
The algorithm repository has excerpts from the book: http://www.cs.sunysb.edu/~algorith/
namin
This is a remarkable book.
Robert Rossney
I just borrowed this out from the uni library : its a shopping catalogue for algorithms. It describes the problem then tells you to link to some library on the web somewhere without really describing the exact algorithm used.
paperhorse
+14  A: 

The Art of Computer Programming by Donald Knuth.

Glomek
I enthusiastically recommend Knuth's books if he has written specifically on an area you're interested in: searching, sorting, combinatorics, etc. But I would not recommend his volumes as a general introduction to algorithms.
John D. Cook
Exactly -- TAOCP is not a general introduction to algorithms. Knuth's books are about depth and perfection, not breadth -- his volumes on the topics most commonly encountered in a first algorithms course are still upcoming :-)
ShreevatsaR
I especially like the "still" part. How long have the computing world been waiting now? :D
KTC
A: 

There is only one: "The art of computer programming" by Donald Knuth

EricSchaefer
duplicate of another answer
fmark
Wow. This was really helpfull. Did you realize that the two answer were given at the same time?
EricSchaefer
+1  A: 

Algorithms for Programmers by Jorg Arndt is a free, online ebook, although the examples are in C++.

Marc Charbonneau
A: 

I have found these quite useful in the past:

  1. Introduction to Algorithms, Second Edition by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein The MIT Press © 2001
  2. Analysis of Algorithms: An Active Learning Approach by Jeffrey J. McConnell Jones and Bartlett Publishers © 2001
  3. Algorithms and Data Structures: The Science of Computing by Douglas Baldwin and Greg W. Scragg Cengage Charles River Media © 2004
Vincent Ramdhanie
I think the request was "One book per answer so they can be voted on"
S.Lott
+1  A: 

The Python Cookbook. Algorithms and recipes are analogous which is where the title of the book comes from.

I have the first and second editions of the book and have never regretted buying it. It's a great collection of Pythonic code.

dowski
+1  A: 

Mastering Algorithms in Perl is not bad. It's not a python book, but it does a decent job of showing algorithms implemented in a high-level language.

David Nehme
+1  A: 

The Tomes of Delphi: Algorithms and Data Structures, the source code can be easily translated to other programming languages.

Data Structures and Algorithms: Annotated Reference with Examples

alexandrul
+2  A: 

I find that I can't wrap my mind around those books. Knuth's is great and all ... but I'm not so deep into mathematics that I could understand what he writes. Even though I build code every day that is many times more complex than what he explains. Ahem. Yes, that code does work (mine and his) ;) And I tried to understand Knuth. I love TeX. I use it as often as I can.

My best source for good algorithms was always and will always be existing code. If you like Python, check the huge library that comes along with it.

If you don't understand something there, fix the documentation. This will make you understand and it will make it easier for the next girl/guy to achieve the same thing. Apart from that, Wikipedia is a good source for an explanation for the same reasons.

Aaron Digulla
A: 

My favorite book on algorithms is just called Algorithms, by Dasgupta, Papadimitriou, and Vazirani. It's a rather theoretical treatment, but it touches on fascinating subjects and, best of all, a version is available online.

Knuth's TAOCP is definitive, of course, but it is not a book for beginners. It's actually not a book for very many at all -- I'd treat it more as a source and a bible than as something to learn from.

adrian
+1  A: 

the algorithm design manual by steven sienna.

less dry, more puff.

melaos
+2  A: 

How about a classic? Algorithms + Data Structures = Programs by Niklaus Wirth.

Angel
+3  A: 

I would recommend "Algorithms in C++" by Robert Sedgewick. (There are also versions with the code in C, Pascal and Java).

staticsan
i find sedgewick's books to be a fantastic resource. much more rigorous and thorough covering the fundamental algorithms than Intro To Algorithms, but far more readable than Knuth.
Autoplectic
+1  A: 

Algorithm Design by Jon Kleinberg and Eva Tardos. Contains extensive coverage of all the cool things you'd learn in a second course on algorithms.

There's also the previously mentioned Introduction to Algorithms by Cormen, Leiserson, Rivest and Stein, which is comprehensive but not always as in depth as I'd like. Kleinberg & Tardos choose their topics somewhat differently but provide a lot of explanation.

dwf
+1  A: 

Well the one the told us to use in college is Cormen - "Introduction to algorithms". Book seems good but is quite time consuming. Not exactly the best if u're a beginner. I myself am looking for something more practical, however I do require the mathematical aspect of the algorithms as well.....

cheers :)

A: 

Everyone seems to go with the Cormen book as far as Algorithms go. I'm just wrapping up taking my very first Algorithms class, and have had one heck of a time. Our teacher picked the Dasgupta book, Algorithms. As was stated earlier, and I can tell you from personal experience, this is not a book for beginners to be learning from. The examples, when given, are the most simplistic versions of the problems, and chapters are often interspersed with "figure the rest out for yourself!".

Sorry to sound like a book review here, I just can't stress enough to stay away from the Dasgupta book. Hopefully the next time I take (or re-take as things are going) the class, we'll be using something better.

Charasan
+1  A: 

If you're after algorithms for numerical computing rather than data structures you might like to take a look at "Numerical Recipes in C" which I've relied on for years for implementations of mathematical formulae.

It's available in a C++ edition too, updated and revised.

Trevor Tippins
+4  A: 

Books by Thomas Cormen and Donald Knuth are bibles or encyclopedias. They don't really tell you how to think or create new algorithms. Whats missing in those books is that they don't teach you art of creating algorithms, rather they are into describing algorithms. They are more as reference guides.

Book by Dasgupta is clearly not meant for novice, and you should have a sufficient exposure to algorithmic theory before reading it. BTW, this book has some nice problems sets.

I have read many books on algorithms, and as far as learning the art of creating algorithms, the best book I have read is by Jeff Edmonds: "How to think about algorithms", Cambridge. I think every CS guy should read this book. Focus of this book is on learning generic concepts rather than rote learning of existing Algorithms. I don't think any of the books available on algorithms can match this books teaching style.

Another book which I found really good is "Analysis of Algorithms: An Active Learning Approach by Jeffrey J. McConnell Jones and Bartlett Publishers © 2001"

varun nagpal
A: 

Here is what I learned:

For theoretical knowledge start with "Introduction to Algorithm", and then for advanced topics read Tardos and Kleinberg "Algorithm design" book (and try to solve all the problems). I specially like Kleinberg writing style.

If you have the guts and patience (and mathematical skill, don't be ashamed if you don't have the mathematical talent, many people don't have and those people only buy knuth books and never read) then instead of CLR book read Knuth, start with reading volume 1 and 3, volume 2 has more mathematics then algorithm. Chapter 2 is data structure and chapter 5,6 is searching and sorting. But take knuth books with a pinch of salt. In the time you finish 2 knuth books you can finish 4 normal algorithm books. And also there are other great algorithm books to read like "Randomized Algorithm by Motwani and Radhvan", Approximation algorithm etc.

For the implementation purpose Any good book on C++ STL is fine. Actually STL has all the good algorithm and data structure implementation. (STL Tutorial and Reference Guide: C++ Programming with the Standard Template Library) Try to get the complexity of STL implementation and guess how they have implemented, you would get lots of insight.

After reading STL and algorithm theory it's time to use them. Compete in any algorithm programming competition (topcoder etc).

Atul
A: 

Algorithms in a Nutshell

Creating robust software requires the use of efficient algorithms. Algorithms in a Nutshell describes a large number of existing algorithms for solving a variety of problems, and helps you select and implement the right algorithm for your needs. With its focus on application, rather than theory, this book provides efficient code solutions in several programming languages that you can easily adapt to a specific project.

clyfe