views:

1494

answers:

13

As an EE turned software engineer I missed on on the computer science basics. Are the Donald Knuth "The Art of Computer Programming" books worth buying as a reference for filling in the gaps? Or as a reference in general?

+6  A: 

IMHO Knuth's books (though it's been long since I read them) are more of a general reference than an easily-applied textbook. If you are looking for a book that is oriented at someone learning these concepts but without dumbing them down and with sufficient breadth, I would suggest Cormen and Rivest's Introduction to Algorithms.

Uri
+18  A: 

They are a true classic, and if you need that information, that's an excellent place to get it.

That said, many software engineers these days don't implement those sorts of algorithms much, if at all. Rather, they just use implementations of these things in the libraries. If that's what you intend to be doing for the rest of your career, you may not find learning that sort of stuff so important. You can have a long and profitable career as a programmer without knowing that stuff.

Curt Sampson
Even if you're always using library implementations, you still need to know /which/ implementation to use and why. For instance, there's usually going to be a linked list and a vector, but that doesn't tell you which to use.
Matthew Flaschen
@Matthew Is Knuth's the best explanation of the differences between a linked list and a vector?
ChrisW
Knuth's explanations are usually the most *complete*
Nathaniel Flath
I'm sorry but you don't need an encyclopaedic volume of books with pseudo assembly language and PHd level questions to explain to you the difference between a linked list and a vector.
Unknown
+2  A: 

I think it would be overkill for most programmers. Most of the concepts you need could be found in a much more succinct book.

TAOCP is very long and filled with problems that range from easy to PHd material.

Unknown
+1  A: 

The books deliver the theory quite nicely, which is good if (and only if) you actually need to understand the theory of those algorithms. If you are planning on using the algorithms via library methods, but not construct your own, then Knuth's books are likely going to be way more information than you need. The basics of the various algorithms can be found online or in a variety of textbooks, which will provide you with sufficient information for selecting the most appropriate algorithm for your situation.

Elie
+7  A: 

Are the Donald Knuth "The Art of Computer Programming" books worth buying as a reference for filling in the gaps?

Oh, yes.

As an EE + SE (2 courses crunched into 1) I did get the computer science basics. As an inveterate reader I read TAOCP in the library and discovered just how big the gaps were - Knuth points out gaps in places you don't know there are places. After I graduated I bought my own set (they seemed expensive at the time, but a lot of EE texts put them to shame). He has since revised volumes 1 to 3, and released bits of volume 4 - I haven't read the new editions but expect that some of the mid-'70s-ness of the originals has been updated.

Many questions of the form "How do you calculate/solve X?" can be answered "Knuth did it", although it is pretty heavy going in many places.

mlp
+2  A: 

You can pretty much get all the algorithms described in the books from web and other sources. But the detail and in depth discussion that Knuth provide is worth reading. It will provide you very good understanding of mathematics involved behind the design and execution of the algorithms.

As an aside they add great value to your personal library :)

TheVillageIdiot
+2  A: 

you might not need Donald Knuth's books, but do pickup a book or two on data structures and algorithms. try introduction to algorithms: www.introductiontoalgorithms.com. or watch some videos from berkeley/MIT. while you might not really need it to program, the difference between just coding blindly and understanding how things work is night and day. have you ever meet a good/great software engineer who didn't know the basics?

+5  A: 

This depends on what kind of programming you are going to be doing.

As academic reference works they are superb, particularly for topics in combinatorics. If you are implementing low-level arithmetic or often finding that you need to know things like the history and theory of algorithms for sorting using tape drives, then you really want these books. If you're a work-a-day programmer maintaining a shopping cart component, then Knuth is overkill. An algorithm book that holds your hand by using Java, or C, or Python is probably going to be a more useful investment.

I've owned the set for almost three decades now, but I've mostly just picked them up from time to time to try to learn about the theory of algorithms in the abstract. Only once did I actually use them to solve a combinatorics problem I ran into at work.

Charles E. Grant
+21  A: 

The short answer to whether Knuth's Art of Computer Programming are worth a buy is a definitive yes.

I've read Volume I and some sections from his more recent fascicles; and have the following experience to share:

  • The books can be usually read at a relatively normal pace provided one doesn't try too many exercises. The exercises have a tonne of useful stuff, but they take time to complete because of their number and complexity. Even if one cheats and peeks at the answer right away; just understanding Knuth's (sometimes brief) fragments of the answer takes time.
  • For many of the algorithms that have a complex analysis or correctness proof associated with them, these are posed as exercises and the details given in the answers; so usually the math doesn't get in the way of reading the main text.
  • Certain sections are marked with a star and these can be omitted on the first reading.
  • One thing that appears to turn many people off is that the book uses an assembly language for the hypothetical MIX computer (now MMIX). However, most (all?) programs have the corresponding algorithm described in English as well, so if assembly seems to technical to you, you can skip it.
  • The math at some places can get a bit hairy at times; but again it is usually related to the analysis of the algorithm (or sometimes correctness). If you're just interested in the action of the algorithm, you can omit it.
  • And if you begin to take an interest in algorithms (and the math behind it), then these books are a treasure trove of beautiful exercises. You could systematically start attacking the exercises then.

Some downsides, must, however be mentioned:

  • Given the times during which these books were first written and perhaps also Knuth's own preferences, they do not cover algorithms in many important areas -- Computational Geometry, String Searching being major ones that come to mind. Graph & Network Algorithms belong to the volume currently under preparation.
  • In the first 3 volumes at least, the chapters/sections are not divided into things like "Greedy Algorithms", "Dynamic Programming", "Branch and Bound" etc. Nevertheless, these techniques almost surely appear implicitly in the design of algorithms.

So, in short, you could get a lot of mileage from these books even if you skip most of the analysis, correctness proofs and exercises.

However, if you're looking for an all-round coverage of all kinds of algorithms (including computational geometry, string searching, graphs and networks, parallel algorithms) and looking for dedicated chapters on design techniques (greedy, dynamic programming, ...), then perhaps Introduction to Algorithms by Cormen et al would be better suited for your needs.

Ashutosh Mehra
Interesting. My own experience is that if you don't put in a lot of time on the exercises, then the reading time is mostly wasted. If I don't do the exercises I find I don't retain the material. Even worse, I find it all too easy to convince myself that I understood the material when I really didn't. I find that doing the exercises keeps me honest.
Charles E. Grant
@Charles, you are right on the spot: Working out the exercises helps digest the facts presented in the text, gives some bearing as to how the algorithms work and perform, and, gives some sense of achievement or understanding.Moreover, the large number of wonderful exercises, almost all of them answered in some detail, is a unique feature of these books. That, and the analysis parts.However, it definitely is possible to read just the text (skipping the exercises completely), and still get a feeling of the algorithms. It might make sense to do it this way perhaps as a first reading.
Ashutosh Mehra
An informative, balanced answer, +1. As you mention, TAOCP unfortunately predates important advances in string searching, such as linear-time construction of suffix trees and fast algorithms for approximate string matching. These are some of the "hardcode CS" algorithms likely to be of interest to programmers in non-mathematical fields.
j_random_hacker
@j_random_hacker, on the bright side, string algorithms (and also data compression algorithms) are planned for eventual inclusion in Vol 5 (Chapter 9) of TAOCP.
Ashutosh Mehra
+1  A: 

Yes.

It wouldn't give you everything but it would give you a concrete idea why and how of various algorithms which definitely would help you to think better during implememntation phase.

ZiG
+4  A: 

No.

Personally I find TAOCP books too complex and heavy on math. When I see myself and other successful software developers who haven't read it, I seriously think what difference it could have made. If we see around, out of thousands of developers on the face of earth (and the number is increasing on daily basis especially in eastern countries such as India, Pakistan etc), how many software developers have really read it?, I am sure only very few. But isn't software industry still running quite successfully and growing?? Perhaps then the real question is how often developers use/implement advanced data structures and sorting/searching algorithms etc. There remains only little motivation for that especially when everything is available in form of libraries. I therefore think that unless someone is really implementing these concepts or perhaps doing PhD in core computer science disciplines, it wont make much difference if he/she reads it or not.

Jahanzeb Farooq
I agree. I bet most people here answering "yes" haven't actually read them.
ldigas
A: 

Whilst my personal answer is an overwhelming yes, I can appreciate that the style, prerequisites and aims of TAOCP do not suit everyone.

I've been reading Knuth's books for almost thirty years so perhaps I'm getting used to them (and I'm on my second or third copy of volumes 1, 2 and 3). An analogy could be made between the teaching of mathematics at school (up to age 18, say) and the approach taken in a University level Mathematics degree: e.g. increased rigour, knowledge of why the rules of thumb and shortcuts work (and when they might not) and understanding the development of the subject.

The comment of looking at one of the more recently-written parts of chapter 4 before committing to the whole work is valid and a couple of these are now available on the O'Reilly Safari service, if you subscribe to that. Some parts of later works can be difficult without having some familiarity with earlier results and conventions but detailed reading of all the earlier material is not needed and there are parts that can be skipped if your aim is later in the work.

Do give TAOCP a try, but be prepared to give it some time and some work to get the best from it.

mas
A: 

I have no familiarity or experience of computer programming. In fact, I only understood recently how binary numbers work. But I am an undergraduate of Maths. Wanting to learn computer programming from a good theoretical work, I picked up Knuth. With great difficulty I have crossed 3 pages, and on the 4th page itself he introduces memory and registers with annotations M[0], M[1],...., Loading and Storing etc which I don't grasp.

My question is that given my level of unfamiliarity with computing, even though I understand Math, should I pursue with Knuth, and if so, how?

  • A
AZG