Knuth's Art of Computer Programming, V 4B, has gone into print
www-cs-faculty.stanford.edu
www-cs-faculty.stanford.edu
I started talking to him about some of the latest AI research and he mentioned the papers authors, he had already read them! Not only is he still very productive at 84, but he has not ossified into one particular subject but he continues to keep abreast of other related fields.
He also played his huge pipe organ for us, he was gracious, humble, down to earth, truly a treasure. I only wish he could live another hundred years, selfishly so I could see Volumes 5, 6, and 7 of Art of Computer Programming finished.
I should not with some sadness that COVID hit not long after and that year we lost a number of other luminaries in the field like Jon Conway.
[1] https://www.health.harvard.edu/healthy-aging/what-does-it-ta...
Well, the editor wars are over folks.
More seriously, Don Knuth is a treasure. One of the coolest things about computing science is how all the greats in the field are either alive, or within the living memory of people who are.
Like the 5th picture down you can see him standing (he uses a standing desk!) and if you blow up the screen, you can see part of an emacs window on the left hand side. I believe he also was using emacs shell windows as well, but not 100% sure.
Direct Link: https://d2r55xnwy6nx47.cloudfront.net/uploads/2020/04/DK_VC_...
I can't emphasize enough how incredibly nice and welcoming he is. He is bursting with enthusiasm for computers, and my wife and his wife had to almost restrain him so he would sit for his pictures, because he would start talking to me again about computer related stuff.
He's got Xeyes on the right, and the shell windows could conceivably be Emacs too, but if so, he's customised them to remove the minibuffer.
the only mistake you won't be able to correct from observing screenshot is the "look like org-mode" thing. it's https://www-cs-faculty.stanford.edu/~knuth/programs/color-mo... minor mode which lets you highlight arbitrary lines in a buffer.
Great quote and great insight. Understanding how the brain works and is stimulated augments communication. Especially important for dry, theoretical subjects.
The Emacs window is held in a frame. The operating system calls that frame a window, but that's not what Emacs calls it.
https://www.emacswiki.org/emacs/WindowsAndFrames
As to why Emacs calls everything something else, well, Emacs was first. As to why Emacs doesn't change its names, well, have you ever tried to change Stallman's mind?
(Sorry have to run …)
> as fast as any 20 year old. I I certainly hope so. Though I think it's more likely that Knuth can be as fast as other 20-year olds, but not as the 20-year old of himself.
Also great on the harpsichord and piano.
(Sometimes I joke about how my hands know emacs, not my brain - but if someone asks me what keys I hit for something, my fingers move and then I work backwards from that.)
(And if you're collecting correlations - I have no musical performance talent at all and have spent maybe 10 hours total poking at musical keyboards - for me, typing is all typing, I expect musical keyboarding is a related but parallel thing, not the same thing.)
I'm still one month into switching to a macbook, and I now dread cutting and pasting. Oh, and typing "pipe", too.
I wonder how long it will take my 40+ years old brain and hands to get their act together...
I prefer the concept of international standardisation to an American layout in pretty much all areas, with the exception of the keyboard layout; ANSI layouts are far more friendly - for programming, at least. Not just the enter key but the left shift too.
Shrug, I guess ?
I'm constantly perturbed and interrupted when some app window just 'hangs' for a few seconds (some garbage collection going on, probably?). I can't pinpoint any one thing, just... everything seems relatively slow in 2022 compared to, even 10 years ago, and certainly 20. Applications weren't always phoning home to check things during bootup, which I suspect happens a lot now. Our computers are dozens of times faster than in the 90s, and, computationally, some things get done much faster, but others - around UI, it seems - apparently regress.
If I'm in windows I use virtuawin with alt+1, alt+2, etc for switching desktops. Not nearly the same, but works so much better than the builtin crap Windows has.
Paradoxically, I don't use alt+tab in windows to switch between programs. I used to do that, but then around XP (I think) they added the ability for programs to inject themselves into the alt+tab list. That means it's no longer completely consistent, which means I now have to think and check what alt+tab actually does so it stopped being any faster than just using the mouse.
So now if I need to flip between them quickly I'll either put them on different monitors (I use 3) and/or put them on different desktops. The combination makes me effectively as productive without the use of alt+tab. And it feels similar-ish to i3, so it's a bit comfortable in that respect as well.
NOTE: Anyone thinking virtuawin is like i3, it's not. It's just the best virtual desktop on windows (imo of course). Nothing on windows comes close to i3.
VSCode has a pretty bad latency problem, and it's the reason I stay away and use Notepad++ or VS2022. Sublime if on Mac.
I use git on the command line. My largest bitch is when it says "invalid command. you typed 'statsu', the closest command to this is 'status'"
Kill me now - it's a non-destructive command, and you KNOW what I was trying to say!
Those mishaps don't happen in IDEs.
Ironically, the old apps that just "hang" for a while during initialization handle this better, because they don't process input at all, so it all just gets queued.
First there’s the cognitive overhead involved with the task itself, as opposed to letting your fingers do the work while you think about real stuff. Second, when you’re slow at typing, typing becomes the bottleneck more often, and your brain is sometimes idling waiting for your typing to catch up. Your brain has the hard part; it should always be the bottleneck. Third, typing fast gives you more options, because you don’t consider “how long will this take me to type out?” when considering different approaches to some immediate challenge. If opening a REPL and evaluating something is going to take you five minutes, you might not do it.
I suspect your friend was a fast worker despite being a slow typist. If he learned to touch-type, he could always have spent the same time thinking as he does now then less time and effort actually typing it.
However, sometimes I have the opposite desire. I can type on a normal keyboard at 80-90 wpm. On an iPhone I'm probably 1/4-1/3 of that. However, I probably spend 60-90 minutes a day reading/writing emails from my phone. Sometimes going slower allows you go to faster.
> Your brain has the hard part; it should always be the bottleneck.
Or maybe not. Lots of famous people (particularly physicists) talk about the importance of letting the mind wander i.e. the opposite of making sure it's the bottleneck.
I'm a slow phone typist but it's still easy to do. My brain can still think of the next thing to write, or wander.
He had recently been working on 3:16 and showed us some of the original calligraphy that he had at home at the time.
What a lovely man, as well as being a multi-talented genius.
• Mathematical Preliminaries Redux: https://cs.stanford.edu/~knuth/fasc5a.ps.gz
• 7.2.2 Introduction to Backtracking: https://cs.stanford.edu/~knuth/fasc5b.ps.gz
• 7.2.2.1 Dancing Links: https://cs.stanford.edu/~knuth/fasc5c.ps.gz
• 7.2.2.2 Satisfiability: https://cs.stanford.edu/~knuth/fasc6a.ps.gz
The first three were published together as "Volume 4, Fascicle 5" in 2019, and the last one—Satisfiability—was published as "Volume 4, Fascicle 6" in 2015. Of course the actual publication as Volume 4B has hundreds of fixes and additions beyond what was published earlier, and a lovely preface that you can read here: https://www.informit.com/articles/article.aspx?p=3143614
> You might think that a 700-page book has probably been padded with peripheral material. But I constantly had to "cut, cut, cut" while writing it, because […] new and potentially interesting-yet-unexplored topics kept popping up, more than enough to fill a lifetime; yet I knew that I must move on. […] I wrote nearly a thousand computer programs while preparing this material, because I find that I don't understand things unless I try to program them.
Anyone aware of any software bug bounties that predate Knuth’s?
___________
[1] https://news.ycombinator.com/item?id=33066313
- specifically: https://youtube.com/watch?v=IoXiXlCNoXg&list=PL590L5WQmH8dsx...
> So I sat down with him and proofread the pages as they came out of the typewriter. It seemed that he was composing and typing as fast as I could read. By morning the manual was done. Years later when don's first book came but, he told me that if I would proofread it for him that he would pay me a dollar for every error that I found, including typographical errors. I took the offer as a great personal compliment at the time, but I think that he probably made that a standing-offer to anyone.
also from earlier in that essay:
> don claimed that he could write the compiler and a language manual all by himself during his three and a half month summer vacation. He said that he would do it for $5000. Our Fortran compiler required a card reader, card punch. line printer and automatic floating point. Don said that he would not need the card reader or card punch, but he wanted a magnetic tape unit and paper tape. I asked Gerard Guyod how Brad could have been suckered into paying this college kid $5000 to write something that had to be a piece of junk if he was only going to spend three and a half months on it. Gerard whispered his response to me. He said "We think that he already has it written. He probably did it in his spare time while working in the computer center at Case Institute." I still wasn't entirely satisfied with that answer because I was a college graduate whose first job was for 5325 per month and I had just changed jobs and was making $525 per month. Besides that it was taking mortal human beings 25 man-years to write compilers: not three and a half man-months. I thought that Brad had taker leave of his senses.
From your wiki link:
Initially, Knuth sent real, negotiable checks to recipients. He stopped doing
so in October 2008 because of problems with check fraud. As a replacement, he
started his own "Bank of San Serriffe", in the fictional nation of
San Serriffe, which keeps an account for everyone who found an error since
2006.[2] Knuth now sends out "hexadecimal certificates" instead of negotiable
checks.That was a reference to google filtering their presented results instead of being driven more by search results, as they advertise that they are.
> In the case of fb, he was outfoxed, because he didn't have the documents to prove that he created all the algorithms for matching faces.
That sentence was a nod to the accusations against Zuckerberg for stealing the original code for FB.
Of course, this was all presented in the context of the prodigiously productive Donald Knuth for your reading enjoyment. In this way, the comment was meant to show though tongue-in-cheek how great Knuth is for Comp-Sci. It was not an attempt to drag any company through the mud. That happens without me.
> Knuth has even written a book, Concrete Mathematics, that covers these pre-requisites but it might be faster and easier to watch a Khan Academy video!
Which suggests KA as an alternative to CM. Which doesn't follow if it doesn't cover the same material.
I've a moderste grasp of induction etc, but my impression is that that's all that's required.
The best part of TAOCP for me is how incredibly good the exercises are. The gradual difficulty is perfect and from 20 onwards you always get some interring insight from solving them. I am especially M and HM ones which are amongst some of the best maths problems I have seen despite being in a CS book.
I suggest skipping around on an "as needed" basis.
Try Volume 1, Section 2.2 "Linear Lists", as a starting point. I promise you its an easier read than you expect. Despite being relatively easy material, you will probably learn something about arrays with just maybe ~3 or ~4 pages worth of reading material.
Start at the start of Section 2.2. Maybe work your way backwards to Section 2.1 as you realize its not as hard as you think (so you start at the "proper" starting point). And then go on from there.
Its really basic stuff. But hitting "rock bottom" on the subject of arrays, stacks, queues, and such is fascinating.
Which is to say I don't think many people have actually worked their way all through them. Neither have I, there's no shame in that.
And, as you point out, it's not too late to give it a try.
https://www.folklore.org/StoryView.py?project=Macintosh&stor...
but probably didn't happen that way.
Also, there couldn't be a bigger contrast between Stephen Wolfram and Donald Knuth. Knuth rightly should have a big ego, but he is a very humble, generous man. Wolfram seems to have a chip on his shoulder, fights with other academics, seems to want to be given credit for being "first!" on things.
I love Mathematica, but Wolfram himself is a controversial figure who often gets in the way of his own work.
For example, the first volume consists of 2 "chapters". Each chapter spans about 250 pages on its own. So actually not a chapter, but a section, or maybe even a book in its own right. Then, each chapter is broken into sections and subsections that flow one into the next. There's a fundamental lack of whitespace and breathing room in a book that is supposedly "beautifully formatted".
At the very beginning of the book, there is a flowchart for how you're expected to read the book. It's not linear. It's not even close to linear, even within a specific topic. So why not just format the book in the suggested reading order?
I don't agree that Knuth is a great communicator. He's verbose when he could be succinct. He's taciturn when he should expound. He's prone to flowery language with humorous barbs in his introductions (and they can be quite funny, if you are clued in enough to what he's talking about already), but then spews dense mathematical notation when he gets into details.
So yeah, there's a lot of interesting information in the book, but it's a struggle to read it. Some people will say it's supposed to be a struggle, it's meant to make you work. Why? Programming is already hard on its own. Why make the act of reading about programming hard, too? I think, for the amount of effort being put into them, they could have been written more clearly. It makes the books feel like they are designed to mark an in-crowd of mathematicians who learned programming rather than to teach people computer science.
Beautiful formatting here refers to the text, not the whitespace.
I don't find the text in any other book I own to be insufficient, or even noticeably that different from Knuth's books (with the obvious exception of some fly-by-night print-on-demand stuff purchased off Amazon in recent years). It's an assertion in want of proof. TeX might be the greatest example of Yak Shaving in human history: Knuth spent at least 30 years between Volumes 3 and 4 to work on TeX because of dissatisfaction with layout in V3.
This is what I'm talking about. Notice the use of colored blocks and whitespace to break up the flow of the page, to callout different asides and section headers.
https://twitter.com/Sean_McBeth/status/1577388169418383363
Adding whitespace doesn't have to make the book longer. It could just make the book wider. Besides, paper is cheap.
I will be a counterexample: I read all three cover to cover, and seriously attempted every single exercise (although in some cases, "attempted" just meant "actually understand what he's asking, which in itself sometimes took me several days). I didn't skim or jump around at all.
But regarding your complaint about formatting, note that the book design of the TAOCP volumes is not Knuth's doing: someone at Addison-Wesley came up with them in the mid-1960s, and the first three volumes were published with Monotype (hot-metal) typesetting. When Knuth wrote TeX in the late 70s/early 80s, his goal was simply to retain the style of the books. (The layout was fine; the publishers were trying to move to phototypesetting and the fonts were poor https://tex.stackexchange.com/questions/367058, so he needed digital fonts and wrote METAFONT to create them, and he needed TeX just to be able to use those fonts.) Perhaps the book Concrete Mathematics will be a better example for you to critique, as Knuth had more of a hand in its typesetting (though there too a book designer was involved; the article Typesetting Concrete Mathematics has some details, reprinted in the Digital Typography volume and a poor scan of its earlier publication here: https://tug.org/tugboat/tb10-1/tb23knut.pdf).
About chapter length: the initial table of contents was one book of 12 chapters; Knuth wildly underestimated the printed length of what he had written (not many people know he actually wrote the whole book, all 12 chapters, in the 1960s, amounting to about 3500 pages — since then you can say he's been updating the chapters and publishing each section when he thinks it's ready), so the plan changed to seven volumes with the same chapters. And the chapter sections' lengths have themselves grown with the growth of the subject; as you can see, the current volume 4B is just a tiny fraction of the projected Chapter 7: covers 7.2.2.1 and 7.2.2.2.
Also, about the flowchart for how to read the books: it's partly a joke about flowcharts, but the suggested reading order is very much linear: https://i.stack.imgur.com/UCsOx.png — in words, it's just something like "read the chapters in order, skipping starred sections on the first reading. Also, feel free to skip boring sections, and skim math when it gets difficult" (he addresses the mathematics in the preface on p. viii).
cba/to frustrated to re-redo it right now.
These books are not really programming books, they are math books. There are oodles of "programming" books out there that teach algorithms, like how to implement a quicksort and why X algorithm is better than Y for problem Z. Knuth's books are more like a graduate level algorithms or discrete math course.
>then spews dense mathematical notation when he gets into details
Because the Art of Computer Programming isn't really about programming per se, it's about the theory and analysis of programming IMHO. I'd say O'Reilly books for more famous for learning programming.
Disclaimer: I'm nowhere close to finishing any of the books.
Regarding more classical algorithms, I never bothered reading the other fascicles. I think there are much more practical references but none is as complete and detailed as Knuth's treatment. He goes to the bottom of any algorithm, not just proving it has the right complexity but also asking what inputs are the most difficult, what other problems it can solve, etc. In the end you understand the field much better and have a good idea of what the boundary of knowledge (ie research) looks like.
But, and I say that as an ICPC world finalist, if you just want to solve practical problems you probably won't need TAOCP.
I enjoyed the dancing links stuff from a recent fascicle. I used it to build a sudoku solver in C. So it's moderately useful.
That's the only time I've ever used them though.
This way my computing is based on a strong foundation...
Your laptop stand will likely become a family heirloom in the decades to come.
The point of a job, unless you're lucky enough to get a job where you can change the world, is to pay your living expenses so that you have the leisure to do things like read TAOCP and write Sudoku solvers. If that's not your idea of an enjoyable vacation, don't read it; you'll regret it.
Whether these things positively exists outside of one mental experiment is an other matter, but so is the notion of individual and self.
Most of the time, perspiring with worry that a 1960s article might have scooped me.
The book showed me the method of how to do it efficiently in a manner that could be adapted to the 16 bit architecture I was working with. It also showed me how to detect and handle overflow situations, as well as when they would happen. It kept me from creating a buggy, error-prone pile of crap code that I'm certain I would have created at the time.
At the same time, it took me a couple of days of study to understand the two or three pages I was interested in. The material was the most condensed material I have consumed in computer science. Like you say, you have to learn a new machine architecture and assembly language to understand the examples. Things you learn from those books come at a high cost in terms of time and effort.
It reminds me of studying the bible, where cross checking, reading different translations, studying hebrew and greek, and the culture of the day are all necessary if you want to get the best understanding you can. The TAOCP books are scholarly articles and almost a kind of shorthand notation of computer science concepts.
I didn't realize it had been blurbed by a professor emeritus at a seminary (as well as Martin Gardner).
Glad to know that the problem isn't totally me :)
For example, in Volume 4A there's a simple technique for comparing two pointers in bit-reversed form. This technique was patented by Hewlett-Packard as a method of randomizing search trees (treaps):
https://bugfix-66.com/fdb8bb4fa84cf810aa25ff40c88a13c1874410...
From Volume 3, here is by far the fastest method of sorting integers (Singleton's method), an algorithm I have used professionally several times (e.g., for beam search in a speech decoder):
https://bugfix-66.com/834f0677c85b23c0bf1047d3654ab7c27ff054...
Knuth's books are just packed with gems like that.
The meticulous high quality of the books is also remarkable. However, if you look very carefully you can find rare mistakes. I received payment from Knuth and have an account at his bank:
https://www-cs-faculty.stanford.edu/~knuth/boss.html
Getting your name on the above list was once a Hacker rite of passage.
Opened the book, thought "no, it can't be". Agonized for days and weeks if I'm making a fool of myself.
Sent the bug report.
First word in first sentence in first paragraph in first chapter was wrong. Got my cheque. ;-)
But the number of parameters is finite, and all parameters have a finite number of possible values.
His errata changed the wording thus:
Zillions of alphabets can be generated by the programs in this book. (https://ftp.rrze.uni-erlangen.de/ctan/systems/knuth/dist/err...)
I was so excited.
I then checked the errata. It was known.
It took another 20 years before I found an actual mistake, regarding the early history of superimposed codes. A very specialized topic where I have one of the few copies of the patent challenge distinguishing between random superimposed codes and arbitrarily selected superimposed codes.
I have a check.
I suspect that most of these algorithms have been implemented and available as libraries for people to use. The challenge of programming has moved from designing such isolated algorithms to modeling the problems, modularizing the code, creating an evolutionary path for a system, and balancing the wants of tomorrow with the needs of today.
Still, if you are working at the core problems of organizing, searching, sorting, managing data, you might might the books useful.
I implemented it to a tee, only to see it fail (I think in the part that merges abandoned blocks). I banged my head against this problem for days before finally daring to entertain the notion that the algorithm might be flawed. This was TAOCP after all!
Turned out my university library had an old edition and I had run into one of the scarce bugs in it (which had been duly fixed in the next edition).
So yes, I have used TAOCP on the job and, to prove it, a scar of which I am rather proud.
(Adapted from Feynman, who apologized for errors in his Lectures, but refused to accept blame for anyone who cited them in a dispute. The truth speaks for itself.)
I read some of Vol 2, Seminumerical Algorithms, to hone my instincts on how random numbers work in practice. I have referred to it on occasion when people say things like, "if we seed the random number generator, take the random number, then feed that into the seed, the result would be more random."
I read most of Vol 3, Sorting and Searching, when applying for jobs. It was more interesting than leetcode grinding. I don't know if it was more useful, but it was better for my sanity.
I thought a little about it and saw that it would degenerate into sat solving.
I checked taocp and indeed my colleague's idea was in there. Also a faster algorithm was presented in the relevant section. I lended the book to him and we saved around a month of work.
Also, while no fast algorithms are known (and may never be depending on if p=np) some are faster than others depending on the properties of your inputs, and choosing the right one can mean saving a lot of time and effort.
If you have constraints, i.e. not enough compute, not enough memory, not enough storage, then you'll need a solution and, odds are, somebody has had the same problem before and it's been written up already in Knuth's TAOCP. Of course, the problem won't be exactly in the form it's been written up, but you have to have enough experience and knowledge to know the abstract form of your problem in order to figure out what parts of TAOCP would be useful to you.
Want a concrete example? Well, I'm in the generation that go to assume that storage was basically constant access regardless of whether you wanted to access the 1st byte, or the Nth one. New, high-performance memory like NAND flash, is weird because it's fundamentally unreliable. In order to make NAND reliable you have to do stuff, and some of the stuff you can do, makes NAND look like tape, and accessing tape is best done sequentially. Guess what TAOCP has? All these great ideas about maximizing random access to sequential media.
That man had a family...
It's good to remind myself that I'm basically a plumber for the internet tubes.
Of course other resources exist, many of which cite TAOCP or are derived from it
Consider, as an example, Fascicle 5b, Introduction to Backtracking. His citations in the first 25 pages are from 1899, 1918, 2017, 1957, 1967, 1963, 1900, 1947, 1882, 1848, 1849, 1850, and 1960. Had he somehow managed to write this chapter in 01968 instead of 02019 he would only have been missing one of them, though surely the illustrations and experimental results of his own he reports would not have been as excellent, and surely the overall framing of the section benefits from the additional 61 years of hindsight.
In fact, although enormous progress has been made in backtracking in recent years, it hasn't affected the introductory aspects of the question. But clearly you can learn an enormous amount about backtracking without straying into the literature of the current millennium.
In terms of actual programming use, not much, but I still haven't read the other volumes yet.
TAoCP is aiming at damn near "perfection" of programming. Donald Knuth is analyzing the exact assembly language of all of his decision-making with these algorithms. The assembly language is represented as a random variable, and an _exact_ count of those assembly language statements (in loops and other complex jumps) is analyzed.
Everything from the highest-level algorithm design / mathematical concepts is discussed... down to the lowest-level assembly level details / implementation of the code. And everything in between.
-----------
As such, when Knuth / TAoCP covers a subject, it feels comprehensive, in a way that no other writer has ever accomplished.
So how does this work out in practice? Well, there's plenty of tutorials on hash tables out there. But only Knuth's writing on Hash tables / linear probing has ever hit the entire subject for me.
Other books will go over linear probing vs quadratic probing vs double-hashing. Meanwhile, Knuth carefully derives the formulas of each, and how it changes at the assembly level implementation.
-----
Is that useful for workplace environment? Probably not. In work, you only need to know "Linear Probing Hash Tables work like this, do it", and maybe not the analysis of it.
But if you're doing more fundamental programming, such as "GPU Implementation of Hash Table", something that very few other people have done... the Knuth-level analysis is the only thing that hits "rock bottom" and gives me all the insight "behind" the data-structure and its design.
I'd say Knuth's stuff is for people who invent new fundamental data-structures or other implementation details like that. Its not for typical workplace programming.
--------
For anyone who wants to know Knuth's writing style, I think his writing on Alpha-beta pruning (from the 1970s) is an excellent introduction to Knuth's writing style.
"An Analysis of Alpha-Beta Pruning" by Knuth / Moore, 1975.
Alpha-beta pruning always was kinda mystical to me. But Knuth recognizes the intermediate steps needed to understand the subject fully. The brilliance of discussing F1 (branch-and-bound) before discussing F2 (alpha-beta pruning) cannot be understated.
Knuth recognized that branch-and-bound is what most people thought of by Alpha-beta pruning. But then comes up with specific examples where F2 (true alpha-beta pruning) makes a difference over F1. And then uses math to demonstrate how often these cases come up.
Does it help in implementing AB pruning? I dunno. But it helps a lot if you wanna change AB pruning / change the fundamental search and understand why things are done that way. You only need to study "F2" if you're copy/paste programming. But the study and analysis into "F1" (branch and bound) holds deeper understandings to the entire concept of search trees.
Even if you never, ever, ever will program F1.
At any rate, don't judge the book on the first part - the first part is important to get the rest of the book, and it's as well written as the rest, but it doesn't reflect how much fun (again, fun for those who are into programming in itself) the rest of the book is.
I have so far found 1-2 references that I could otherwise not decode, plus wanted to know about n-way sorting.
And that's how I would recommend to use it. I have it on my shelf to pull it out if I have to. Which is rare but it does happen. And as such it proved value to me, on the job, as I know how to get into these things as needed. But it has a similar insane price to usefulness ratio as an encyclopedia.
What I've done so far? Everything from Sysadmin to DevOps to Engineer (data heavy) to SRE to Data Engineer.
If you want to learn DSA then you should probably start with something that goes less deep, is less complete but covers useful algorithms from many areas.
I read the section on Hash Tables while at work because one of our hash table implementations was exactly what he proposed in his book and there was no explanation on why some things were done, especially the choice of the hashing functions. I first tried looking for the information in other books (like Cormen et al.) but everybody just simply references the book from Knuth without explaining things either. So I bought it just for that...
I really really wanted to have time to read the rest of it. But also my comic book collection and a whole lot of other books I bought in the last 30 years. Maybe one day.
Algorithm training is useful on most jobs for preventing you from going accidentally quadratic.
I did read all three - it took me about three years to get through all three and (at least try to) work each exercise. Useful on the job? No, not really, but I can't think of a non-fiction book(s) I've enjoyed reading much more than these. All of the code examples are in assembler, and not just any assembler, his own imaginary assembler (but you can download a compiler and an emulator for it). I'd be hard-pressed to come up with anything that he covers here that's not already part of the standard library of any programming language you could possibly consider using - but it's still great reading, and illuminating in indirect ways.
I worked as an OS Architect at IBM and then Chief Scientist at a very successful startup. Subjects like analysis of algorithms, memory management, optimizing disk access, search tries, random number generation, and many more found in TAOCP have all been useful in my professional life. I've had to give many technical presentations and to present my designs to committees of experts and CS professors. Knuth wasn't the only source of my preparation for this kind of work, but he was a very important source.
Are there better books on algorithms? Maybe. I also like the popular Introduction to Algorithms [1], Sedgwick's Algorithms [2], and Skeina's Algorithm Design Manual [3]. All of these are good and all of them sit on the shelf right next to Knuth's books. Depending on the subject, any one of these might have the best treatment. BTW, Sedgwick was a Ph.D. student of Knuth.
To keep up with the literature I also recommend a membership in the ACM with access to their digital library.
[1] Thomas H. Cormen , Charles E. Leiserson, et al. (2022), Introduction to algorithms, MIT Press.
[2] Robert Sedgewick and Kevin Wayne, (2011), Algorithms, Addison-Wesley.
[3] Steven S. Skiena, (1997), The algorithm design manual, Springer.
(But ignore everything Skiena says about generating random numbers.)
https://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=...
Ctrl-f "Sedgewick".
That being said, if you already know ASM/C then maybe it wouldn't be as useful.
One job involved indexing arbitrarily large books (gigabyte+ was not uncommon) on an embedded CPU with less than 1MB of RAM available to the indexer (this is 15+ years ago, before smart phones). It also involved searching hundreds of those books in a few seconds with ~8MB of RAM available. Indexing was taking place on a single core CPU while the user was using the device, so the indexer had to be able to stop its work within a few milliseconds of any user action and resume later without losing progress. On the surface, Knuth's concepts felt old fashioned (abstract assembly language and talk of multiple tape drives for intermediate storage). But that mapped very well onto this indexing problem. Books and indexes resided on an SD card and individual files on the SD card could act very much like Knuth's individual tape drives. Doing append only operations on those files (as you would want to do on a tape drive) proved fast and reliable. My 1MB of RAM would have been an embarrassment of riches when the original volumes of TAOCP were released. I don't remember if any of the algorithms that shipped as part of that device were straight out of TAOCP, but the thinking involved was heavily influenced by those books. Whenever I was stuck, it was back to Knuth.
My next job was focused on distributed systems. We were rebuilding an ads system because the older one couldn't handle the scale needed. That involved lots of MapReduce and lots of stream processing (before there were good open source stream processing packages to build on top of, this started in 2010). Those same tape drive oriented algorithms came right to the surface again. When processing TB or PB of data, you want single pass algorithms wherever you can come up with them - merely linear isn't good enough. Same as tape drives - there's a huge benefit if you can avoid having to rewind. And so many stream processing primitives (windowed joins, groupings, etc.) are exactly what people were doing with tape drives 50 years ago. Now we were using many GBs of RAM spread across many machines, but relative to the amount of data being processed, it was still miniscule.
This all required spotting the similarities between the world Knuth drew his examples from and the constraints I was working under. But once I did, his concepts were quite useful. And the framework for thinking about things was more valuable to me than any specific algorithm or data structure. It was much more useful to me as a narrative to read rather than a reference to pull something out of.
I would love to have a career working on problems like this but can't imagine how I'd get a job doing anything but commonplace back-end work.
My path involved working at a series of tiny startups through the first 15 years of my career - the 1990s and early 2000s. At the smallest, I was the only engineer. At the largest, there were 8. At that scale, you learn to do everything (seriously: front end, back end, databases, assembling servers, networking the office, setting literal rat traps, cleaning the cat litter after "upgrading" the rat traps, ...). You also get an opportunity to get to know people very well and build a lot of mutual trust with some of them.
In 2005, the head of engineering from the "big" startup was helping to start a new subsidiary of an established tech company and needed someone to develop indexing and search for the device mentioned above. He asked me to join.
In 2010, the head of marketing at one of those startups was now an executive at a soon-to-IPO company who needed to scale their ad delivery system. She asked me to join.
Both of those relationships had turned into friendships long before they asked me to join their newer endeavors. They knew what I was good at and what motivated me. That resulting in me being deeply trusted the day I joined and being given a lot of freedom to create solutions. So, I guess one way to get this kind of work is experience, relationship building, and some luck.
Thank you for sharing it.
It was actually probably more insightful and useful than I think you may have realized.
I'd love it if someone like Chris Wellons or Per Bothner could work on them, but filling Knuth's shoes may be a big task for one man.
He also seems like the kind of guy you'd want to have a cup of coffee or tea with. Always seemed like a fun and sweet guy in the interviews I've seen with him.
His books were the reason he started TeX.
Donald is 84. And each time I’m reminded of that I get sad, it’s very unlikely we’ll get another 30 years of his work.
People can live well into their 90’s. Hopefully he’s got another book in him. These people are still alive, for example:
Jimmy Carter: 98
Henry Kissinger: 99
Warren Buffet: 92
Charlie Munger: 98
Mel Brooks: 96
Alan Greenspan: 96
Noam Chomsky: 94 in December
~50% of 84-year-old men will die by age 90.
~0.4% of 84-year-old men will live another 20 years.
“From the age of 6 I had a mania for drawing the shapes of things. When I was 50 I had published a universe of designs. But all I have done before the the age of 70 is not worth bothering with. At 75 I'll have learned something of the pattern of nature, of animals, of plants, of trees, birds, fish and insects. When I am 80 you will see real progress. At 90 I shall have cut my way deeply into the mystery of life itself. At 100, I shall be a marvelous artist. At 110, everything I create; a dot, a line, will jump to life as never before. To all of you who are going to live as long as I do, I promise to keep my word. I am writing this in my old age. I used to call myself Hokusai, but today I sign my self 'The Old Man Mad About Drawing.’”
It looks like he started working on it in 1962.
Just imagine being that intelligent and pouring 60 years of your life into something like this.
Then again: SAT-solvers are a big enough subject matter on their own that backtracking search + SAT-solvers is more than enough to fill a volume of its own. So choosing these two subjects as volume 4B makes sense.
-----------
As a fan of constraint programming, I'd love to see Knuth's take on the subject. I hope he doesn't skip over Fasicle 7.
Its not exactly an easy subject, so I'll need some time to digest the material. Especially if its written in Knuth's famous "difficult, but terse" style.
Well, what happened was that he spoke for nearly two hours on self-referential aptitude tests. The kind of "20 questions" game where the 20th question is "The maximum score obtainable on this test is (a) 18 (b) 19 (c) 20 (d) indeterminate (e) achievable only by getting this question wrong" and all of the others are inherently recursively linked. I had no idea these things existed, even less of an idea why anyone would want to study them, and came away later with both mind dripping down the side of my skull and a greater appreciation of SAT solvers and compiler design in functional programming languages. Highly recommended.
(And if anyone wants to do the quiz, it's here: [1] https://www-cs-faculty.stanford.edu/~knuth/paradox.pdf)
However.
What I also learned is how impossibly large a topic even just hashing is. A section of Knuth's encyclopedia isn't sufficient space to cover it thoroughly (for some definition of thoroughly) and further research showed how much progress had been made in the subject since Knuth published his work.
This isn't a complaint about Knuth, again, I'm grateful for how much his writing accelerated my understanding. But further research underlined how impossible a task he's undertaken.
* The Art of Computer Programming, Volume 4B: Combinatorial Algorithms, Part 2
* https://www.amazon.com/Art-Computer-Programming-Combinatoria...
The fourth volume of The Art of Computer Programming deals with Combinatorial Algorithms, the area of computer science where good techniques have the most dramatic effects. I love it the most, because one good idea can often make a program run a million times faster. It's a huge, fascinating subject, and I published Part 1 (Volume 4A, 883 pages, now in its twenty-first printing) in 2011.
The lyf so short, the craft so long to lerne
He doesn't respond to emails, but his assistant does, and I sent a copy of my book about Xerox to his home address. No answer. But hey, it was worth a shot.
Once I recognized him, I told him that I preordered a set of the latest edition of The Art of Computer Programming. He made a joke about collecting royalties from all the books he sold.
I'm glad I had the opportunity to speak to Donald Knuth! I actually saw him earlier this year at a Stanford symposium, but I didn't get to speak to him.
https://www.mmix.cs.hm.edu/supplement/index.html - The MMIX Supplement by Ruckert
The first introduces the updated assembly language, the second updates all the MIX programs from Volumes 1-3 to MMIX.
Since it's divided into sections, you can poke it before bed now and then. You don't even have to buy it: https://aquinas.cc
If I wanted to give it an honest try, what do I buy?
Volume 1, 3rd edition + Volume 1, Fascicle 1?
If I get this right, fascicle 1 of Vol. 1 is used to replace/update the old MIX architecture used in TAoCP with the new MMIX. If so, what about volumes 2-4?
[0] https://cs.stanford.edu/content/contacting-donald-knuth/news...
Said organ was built by its late owner not just in the house, but pretty much into the walls of the house, and as a result the thing had to be ripped out of there rather grotesquely, and then rewired again at the new place: https://youtube.com/watch?v=8PwwRR8deHk
but hey maybe impressive no damage from being lugged around between check outs :)
Am I far off?
Tantalizing.
So when he uses typesetting/printing terms, he's using them correctly.
Honestly after working through those books, you could probably complete self-studying an undergraduate mathematics curriculum.
Best wishes.
That apart, I (and Knuth) recommend just skipping the math parts when they get hard. You can always come back to them later if you're interested.
This is what he says in the preface to Vol 1 (p. viii):
> A few words are in order about the mathematical content of this set of books. The material has been organized so that persons with no more than a knowledge of high-school algebra may read it, skimming briefly over the more mathematical portions; yet a reader who is mathematically inclined will learn about many interesting mathematical techniques related to discrete mathematics. This dual level of presentation has been achieved […] also by arranging most sections so that the main mathematical results are stated before their proofs. […]
> A reader who is interested primarily in programming rather than in the associated mathematics may stop reading most sections as soon as the mathematics becomes recognizably difficult. On the other hand, a mathematically oriented reader will find a wealth of interesting material collected here. Much of the published mathematics about computer programming has been faulty, and one of the purposes of this book is to instruct readers in proper mathematical approaches to this subject. Since I profess to be a mathematician, it is my duty to maintain mathematical integrity as well as I can.
It makes me wonder though why previous published mathematics about computer programming has been allegedly faulty. Since I don't know enough math to objectively see whether Knuth has succeeded in his task or not...
TAOCP could have benefited a lot if someone had written a simpler on-ramping version, with examples in a powerful but newbie-friendly industrial-grade language, such as C#.
I wonder how long that will take to start showing up on interview questions.
https://javascript.plainenglish.io/heres-donald-knuth-s-advi...
https://javascript.plainenglish.io/heres-donald-knuth-s-advi...
I don't mind the mathematical rigour at all, I have benefited from it, but the way the books are structured is all over the shop.
Is there any hope that somebody will continue the work?