Ask HN: Help me choose the best first book for Algorithms
9 comments
Start with The Algorithm Design Manual and understand everything it says. Then try some exercises and re-read the entire book again. Use google to study any math in TADM you don't understand up front.
TAOCP isn't for reading from cover to cover and, arguably, neither is CLRS (especially for "first time through" studies).
TAOCP isn't for reading from cover to cover and, arguably, neither is CLRS (especially for "first time through" studies).
I have some results and there seems to be a consensus for Sedgewick's. There was a course on Coursera mentioned.
Close second is Kleinberg's and Skiena's.
TOACP and CLRS apparently are considered reference reads and not starting material.
I think I know pretty much where to start. Thank you all.
Close second is Kleinberg's and Skiena's.
TOACP and CLRS apparently are considered reference reads and not starting material.
I think I know pretty much where to start. Thank you all.
Does anyone have any opinions on or experience with the MIT OCW Intro to Algo class?
http://ocw.mit.edu/courses/electrical-engineering-and-comput...
For learning - Kleinberg
For reference - Cormen
For reference - Cormen
Sedgewick and Kleinberg are both solid introductory books that are well-suited for someone with little CS knowledge. The Algorithm Design Manual is a great book, but seems to focus more on giving a tour of different problem types and their associated algorithms than developing a deeper understanding of the theory behind it all. Cormen's book is fantastic and very thorough, but may be a bit harder to soak in for a beginner. Finally, while TAOCP could probably be considered the most revered texts on CS, they are not well-suited for a beginner trying to get their feet wet.
All in all, I'd say Sedgewick is the best of these options.
All in all, I'd say Sedgewick is the best of these options.
+1 on Sedgewick. Also added some "light reviews" on another comment.
Are Sedgewick and Kleinberg on the same level? So if I do one can I skip the other and move to say Algorithm Design Manual or CLRS?
From your comment it seems Knuth's book(s) to be the last (and for the mastery.
From your comment it seems Knuth's book(s) to be the last (and for the mastery.
They're on roughly the same level but focus on somewhat different things. Sedgewick spends a lot of time on basic data structures like hash maps and search trees, as well as elementary algorithms like search and sorting, in great detail. Kleinberg instead approaches things more generally by tackling concepts by design technique - greedy, divide-and-conquer, dynamic, etc - and doesn't focus as much on the very basics. Kleinberg also spends a lot more time on more advanced topics like NP completeness, randomized algorithms, etc, while Sedgewick again keeps his focus on the more elementary topics.
CLRS contains pretty much everything contained in both Kleinberg and Sedgwick, so the two are essentially interchangeable in the sense that Kleinberg+CLRS contains roughly the same breadth of information as Sedgewick+CLRS. Since Sedgewick takes more time to explain the basics thoroughly, I'd say it's probably your best starting point.
Good luck!
CLRS contains pretty much everything contained in both Kleinberg and Sedgwick, so the two are essentially interchangeable in the sense that Kleinberg+CLRS contains roughly the same breadth of information as Sedgewick+CLRS. Since Sedgewick takes more time to explain the basics thoroughly, I'd say it's probably your best starting point.
Good luck!
Completely agree with OP.
Although I'd personally recommend Kleinberg's book. I feel that it has a better narrative and is very well written IMO.
Although I'd personally recommend Kleinberg's book. I feel that it has a better narrative and is very well written IMO.
CLRS is the way to go.
[deleted]
http://algs4.cs.princeton.edu/home/ is my favorite. The implementations of the algorithms are really nice (quite a feat, considering the lang is Java :-p) and each section builds on top of a previous one, when needed (e.g. many algorithms require a Symbol Table, which is built in one of the chapters of the first volume). The resulting implementations are incredible terse but at the same time clean and easy to understand!
Cormen's book is a bit more thedious to read and I don't know it that well but I think is a little bit more rigorous with math. Sedgewick's book doesn't mention asymptotic limits or BigO notation, rather talks about the run time / memory requirements in more informal terms, like "run time being proportional to the square of the number of input items", etc. But, there's another book from Sedgewick (and Flajolet!) if you want to go deeper into analysis: (1).
Skienna's book is great to have a wider outline on all sorts of algorithms, including some less widely known and (I think) not covered in either of Sedgewick's or Cormen's book. It is, if I'm allowed the pun, more of a breadth first than a depth first approach to the subject.
1: http://www.amazon.com/Introduction-Analysis-Algorithms-2nd/d...
Cormen's book is a bit more thedious to read and I don't know it that well but I think is a little bit more rigorous with math. Sedgewick's book doesn't mention asymptotic limits or BigO notation, rather talks about the run time / memory requirements in more informal terms, like "run time being proportional to the square of the number of input items", etc. But, there's another book from Sedgewick (and Flajolet!) if you want to go deeper into analysis: (1).
Skienna's book is great to have a wider outline on all sorts of algorithms, including some less widely known and (I think) not covered in either of Sedgewick's or Cormen's book. It is, if I'm allowed the pun, more of a breadth first than a depth first approach to the subject.
1: http://www.amazon.com/Introduction-Analysis-Algorithms-2nd/d...
Agree. Sedgewick's book is great especially because of the implementation. I'd also highly recommend his lectures on Coursera - Algorithms Part I and II. He explains the working of algorithms with animation, which makes it really easy to understand the algorithms.
Algo I ended recently, although it is available for a limited time. It will be back in the fall. I am very much looking forward to that and will definitely try to dedicate the time.
FWIW, the Sedgwick textbook is available on Safari.
FWIW, the Sedgwick textbook is available on Safari.
https://www.cs.berkeley.edu/~jrs/61b/ this course by Prof. Jonathan Shewchuk is by far the best I have come across. Even the course is in Java, I really like the way he lays out all the basic data structure family.
The youtube videos are the icing on the cake as you can get thru them faster than compared to reading a book, if you are starting off I would highly recommend these youtube tutorials.
The youtube videos are the icing on the cake as you can get thru them faster than compared to reading a book, if you are starting off I would highly recommend these youtube tutorials.
* The Algorithm Design Manual by Steven S Skiena Link: http://amzn.com/1848000693
* Algorithms (4th Edition) by Robert Sedgewick et al. Link: http://amzn.com/032157351X
* Algorithm Design by Jon Kleinberg et al. Link: http://amzn.com/0321295358
* Introduction to Algorithms, 3rd Edition by Thomas H. Cormen et al. Link: http://amzn.com/0262033844
* The Art of Computer Programming, Volumes 1-4A Boxed Set by Donald E. Knuth Link: http://amzn.com/0321751043