# How To Best Learn About Algorithms In Depth

I have been reading this site with a great deal of interest, but I find a lot of it goes over my head. This has made me wish to learn a lot more about algorithms and CS in general. As far as I can tell from my research, there are 2 main ways of doing this.

1. I can by a nice thick heavy book and work my way through it slowly but surely.

2. I can "learn by doing" and by a nice book, but instead of reading it cover to cover, move to parts that interest me and work on implementing and applying algorithms I like.

3. ?

My question is, which of the above did the you use and would you recommend the same approach to someone else?

I learned about algorithms in a university course years ago. But if you are to do algorithms using a book, then you need a good one. Two books stand out for me as the way to get into algorithms:

• The Algorithm Design Manual by Steven S. Skiena
• Introduction to Algorithms by T Cormen, C Leiserson, R Rivest and C Stein

The first is perhaps more of a hands-on manual, whereas the latter is more like the bible, but with proof.

The strategy you could follow would consist of reading, doing the theoretical exercises, and then implementing as much as you can, focusing on algorithms/problems you find interesting or challenging or both. Thus, try to cover all aspects of algorithms, not just implementing them. This will include studying their time and space complexity and proving their correctness. The study of algorithms is more than just implementing algorithms.

After you've gained enough experience, start specializing. If you become interested in Computational Geometry or non-blocking algorithms, for example, then start exploring books and research papers in this area.

Specialization is good, but it is also good to sample techniques from other areas, so reading broadly about algorithms (and implementing such algorithms) is a good way of maintaining a broad skill set.

EDIT: After going through the introductory algorithms, you may consult books like Randomized Algorithms by Motwani & Raghavan or Approximation Algorithms by Vazirani. These books are a survey (and to some extent, a good learning exercise in mathematical techniques) in more advanced algorithm design techniques. They also broaden your insight into many other fields in CS like Graphs and Networks, Data Structure design and Optimization.

• Started reading a copy of Algorithm Design Manual online and I love it so far! Thanks! – Daniel Gratzer Mar 28 '12 at 2:50
• I would rephrase one sentence slightly: The study of algorithms is only incidentally about implementing algorithms. – JeffE Jun 7 '12 at 15:51

Teach an algorithms class.

Or perhaps even better:

write an algorithms textbook.

• +1. I considered this a joke initially, but reconsidered it and realized that nothing let's you understand in depth something as when you are forced to help someone else to learn the same concepts. An this of course includes, for a professor, both teaching classes, preparing lectures notes, notes and of course, writing textbooks ;-) My two cents: preparing exercises helps quite a lot too. For a student, I agree with the strategy proposed by @Dave Clarke. – Massimo Cafaro Jun 9 '12 at 13:43
• No, @vzn, this answer is completely serious. – JeffE Sep 6 '12 at 22:01
• ah well was afraid of that — then an answer appropriate/adapted to anyone who is not a teacher or professor (which is a very narrow subset of the population) might be "teach the algorithm to your friend" or "write a description of the algorithm from memory & have someone try to read and follow it" – vzn Sep 6 '12 at 22:04
• Don't be so rigid. Why do you have to be paid to teach (or write) in order to teach (or write)? Teach your colleagues. Teach your kids. Volunteer at a local high school or community college. Make YouTube videos on your days off. Start an algorithms Pechakucha Night. – JeffE Sep 6 '12 at 22:12
• touche. guess that works if "textbook" is also loosely taken as "writing in a spiral bound notebook, unpublished" – vzn Sep 6 '12 at 22:16

Try solving problems based on an algorithm as soon as you read one. Moreover, for understanding algorithms and implementing them better you need to have a better understanding of Data structures. There is very nice book of data structures written by Sahni. You can use that and for algorithms you can solve problems of programming challenges book. Question are pretty nice there.

If you haven't learned about algorithms at university I recommend taking one of the online classes, you may consider signing up for one of the courses at coursera.org or following videos posted by Stanford University.