Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm a 100% self taught, professional programmer (I've worked at a few web startups and made a few independent games). I've read quite a few of the "essential" books (Clean Code, The Pragmatic Programmer, Code Complete, SICP, K&R).

I'm considering reading Introduction to Algorithms. I've asked a few colleagues if reading it will improve my programming skills, and I got very mixed answers. A few said yes, a few said no, and a one said "only if you spend a lot of time implementing these algorithms" (I don't).

So, I figured I'd ask Stack Exchange.

Is it worth the time to read about algorithms if you're a professional programmer who seldom needs to use complex algorithms?

For what it's worth, I have a strong mathematical background (have a 2 year degree in Mathematics; took Linear Algebra, Differential Equations, Calc I-III).

share|improve this question

closed as not constructive by gnat, Joris Timmermans, GlenH7, Jim G., Caleb Sep 18 '12 at 17:29

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Generally you only actually learn something programming related by implementing it. If you do not want to implement anything, then why spend the time reading it? –  user1249 Sep 18 '12 at 16:33
@ThorbjørnRavnAndersen: It would be more beneficial to do the exercises, but there is great value in just reading the book. I don't have to write code to call every Java library function to benefit from reading about them. There is value in knowing that certain facilities are available, or that certain problems are solved. –  kevin cline Sep 18 '12 at 16:51
@kevincline In that case another book than "Introduction to Algorithms" might be more suitable. –  user1249 Sep 18 '12 at 16:53
How about this abstraction: Would a person benefit by reading? –  MrFox Sep 18 '12 at 17:52
@ThorbjørnRavnAndersen I believe I've learned a lot of programming via reading - I think people learn differently. I will admit you can only prove something programming related by implementing it. –  psr Sep 18 '12 at 17:55

6 Answers 6

up vote 15 down vote accepted

First of all, I personally believe you can't learn enough and you should always be looking at what to learn next, either to deepen or broaden your current knowledge base.

With regards to this book in particular, I would say yes. You stated "who seldom needs to use complex algorithms?". I think the distinction you are making is inaccurate. You use complex algorithms all the time, you just didn't write them yourself. Most current languages and frameworks provide a wealth of complex objects and you comfortably make use of them. But how do you decide whether to use a tree or a hash or a list? Having a deeper understanding of the algorithms underneath these complex objects will help decide which is the correct one to use. I think this is critical knowledge for writing efficient applications. So, learning more about it would be a good thing.

share|improve this answer

I would say that you should only read this book if you 'want' to. You don't really 'need' to. I say this assuming that, at the moment, you are developing applications and games which are performing just fine for your audience and platforms.

When you come across scenarios where the gameplay of your game becomes too slow, you might want to investigate the reasons behind that. Often, use of a better algorithm or data structure does the job.

So, if you read this book, and then start to develop your next killer game, you may be able to recall a nice data structure or algorithm suited to a particular scenario and use it. Also, the thing about reading about data structures and algorithms is, that it sort of teaches and inspires on you how to build your own algorithms.

Besides, there are concepts (for example, recursion) which help tremendously in trying to solve a particular class of problems.

So all in all, I would say, that reading any book on algorithms would do more good than harm. But, do make sure you read an algorithms book which teaches them using a language you know well, otherwise you will end up trying to understand both the language syntax and the algorithm itself at the same time.

share|improve this answer
Even if you don't end up implementing those data structures themselves, learning algorithms and data structures would help when you need to choose which implementation are the most suitable for your purposes. There are hash maps, and there are hash maps and hash maps, there are also hash maps and hash maps, they are all implemented slightly differently and without a sound knowledge of data structure, you won't be able to make an informed decision about which implementation would be the best fit for the specific problem you have. –  Lie Ryan Sep 18 '12 at 17:10

It's not the most approachable Algorithms book. If you have a reasonably high level knowledge of graph theory and concrete maths it's probably great.

If you want to know why a KD-tree is better than a list for certain problems, and how to recognise those problems, then The Algorithm design manual or Sedgewick is probably better.

(see Recommended book about algorithms, data structures and complexity? for links)

share|improve this answer

The adjectives of 'professional' or 'self-taught' aren't critical to the question...

Every programmer can benefit from reading an algorithms book.

(The following is for a java perspective, feel free to think of any other language desired)

There is the aspect of "which implementation should one chose?" When given that one needs a map, what should be the choice? There are the two main ones of the TreeMap and HashMap (and most people likely chose the HashMap without understanding the 'why' behind it). But then there are things like the ConcurrentSkipList or the EnumMap and WeakHashMap that are sometimes better answers for a given problem. But to understand why one needs to understand how a TreeMap differs from the HashMap or SkipList behind the Map interface.

Next, there is the question of "what is out there?" There is a great number of already solved problems. If someone asks "What string in this list is most similar to this string?" where does one start at approaching it? Even without having gone into the underlying algorithm, knowing that there is such a thing as Levenshtein distance (aka edit distance) will point in the proper direction for solving the problem (along with all the other variations of how to solve it in other, similar ways).

share|improve this answer

Of course you will benefit. Lack of familiarity with the material in Introduction to Algorithms will keep you from being hired by some teams. But it's not critical that you are able to derive the worst-case run-time for merge sort. It's very important that you are aware of various sorting techniques, tree structures, dynamic programming, linear programming, network algorithms, etc. Then when a problem arises, you'll have some ideas of algorithms that could be applied, and you won't be the guy who writes a cubic-time algorithm for a problem that can be solved in linear time.

share|improve this answer

I studied this book back in the graduate school. After that, I went back to it a handful of times in my 20+ years of programming. On two of these occasions, finding the right algorithm saved my project*.

In addition to treating specific algorithms, the book introduces generic ways of solving non-trivial algorithmic problems, gives you vocabulary for discussing relative performance of algorithms with others, and provides ways of analyzing algorithms for performance before you start coding them. This becomes more helpful as your projects increase in complexity.

I'd like to point out that the word "Introduction" in the title of the book is misleading: the book has a lot more information than most programmers need in the course of their entire career. It is a near certainty that you would benefit from knowing a subset of the algorithms from this book; the only problem is, it is not possible to say which subset you are going to need, so you should briefly familiarize yourself with the entire book, and study several sections in-depth (Elementary Data Structures, Disjoint Sets, Elementary Graph Algorithms, Sorting in Linear Time, Advanced Design and Analysis Techniques).

* In both cases the simple algorithms that we coded in initially experienced severe performance issues that we were able to overcome by using an advanced algorithm.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.