I received a check from Knuth for 0x$3.00

Donald Knuth — a scholar in the field of computer science who cares so much about the accuracy of his books that he offers one hexadecimal dollar ($2.56, 0x$1.00) for any found "mistake," where a mistake is defined as anything that is "technically, historically, typographically, or politically incorrect." I was eager to receive a check from Knuth, so I decided to look for errors in his outstanding work "The Art of Computer Programming" (TAOCP). I managed to find three. True to his word, Knuth sent me a check for 0x$3.00.

I received a check from Knuth for 0x$3.00

As you can see, this is not a real check. Previously, Knuth used to send real checks, but he stopped in 2008 due to rampant fraud. Now he sends out "personal deposit certificates" from San Serriffe Bank (BoSS). He says he is willing to send real money if necessary, but it seems too cumbersome.

I found two typos and one historical error. I will list them in order of decreasing triviality.

Typo #1

The first typo is on page 392 of the third volume "Sorting and Searching", the eighth line from the bottom: "After an unsuccessful search sometimes (sometime) it is desirable to enter a new record into the table containing K; the method that does this is called the search and insert algorithm. The error is that instead of sometime should be sometimes.

Of course, there is nothing surprising about such an error. In this article, there are bound to be several typos (no rewards for finding them). What is truly surprising is how long it went unnoticed. Page 392 is not buried deep in a math section; it is the very first page of chapter six "Searching"! Perhaps one of the most read sections of the book. Ideally, there should be the fewest typos there, but no.

By the way, if you ever thought about reading TAOCP, give it a try. Many will say it is a reference manual, not intended for direct reading, but that is not true. The author has a clear point of view and a distinctive style. The only thing hindering readability is the complexity of the mathematics. However, there is a simple solution: read until you reach the mathematics you do not understand, skip it, and move on to the next section you can grasp. Reading this way, I skip at least 80% of the book, but the remaining 20% is magnificent!

It is also said that TAOCP is irrelevant, outdated or otherwise inapplicable to "real programming." This is also untrue. For example, in the first section after the introduction, the search for an element in an unsorted array is discussed. The simplest algorithm is known to all programmers. Start the pointer at the beginning of the array, then perform the following steps in a loop:

  1. Check if the current element is the desired one. If so, return it; otherwise,
  2. Check if the pointer is out of bounds of the array. If so, return an error; otherwise,
  3. Increment the pointer and continue.

Now let’s consider: how many boundary checks does this algorithm require, on average? In the worst case, when the array contains no elements, each element in the list will require one check, resulting in something like I received a check from Knuth for 0x$3.00. A smarter search algorithm may only need one boundary check. Attach the desired element to the end of the array, then start the pointer at the beginning of the array and perform the following steps in a loop:

  1. Check if the current element is the desired one. If so, return the response if the pointer is within the array bounds, or an error if not. Otherwise,
  2. Increment the pointer and continue.

In any case, the element will be guaranteed to be found, and the boundary check is performed only once when that happens. This is a profound idea, yet it's simple enough even for a novice programmer. I probably can’t speak to the relevance of this work for others, but I was able to apply this wisdom right away in both my personal and professional code. The book TAOCP is full of such gems (to be fair, there are also many odd things, such as bubble sort).

"Searching, searching
So long
Searching, searching
I just wanted to dance"

— Luther Vandross, "Searching" (1980)

Typo #2

The second error is in volume 4A, "Combinatorial Algorithms", part 1. On page 60, there is a problem about scheduling comedian performances in various casinos. Several real comedians are mentioned, including Lily Tomlin, Weird Al Yankovic, and Robin Williams, who was still alive when the book was published. Knuth always provides full names in the index, so Williams is mentioned on page 882 as "Williams, Robin MacLaurin." But his middle name ends with an 'n' and not an 'm', meaning MacLaurin.

MacLaurin is the maiden name of his mother. She was the great-granddaughter of Anselm Joseph MacLaurin, the 34th governor of Mississippi. His administration does not seem to be remembered for anything good. From the book "Mississippi: A History":

"The most significant event during MacLaurin's administration was the United States' declaration of war against Spain in the spring of 1898... Unfortunately, the war may have provided some public officials with the opportunity to practice bribery. MacLaurin was accused of various questionable practices, including nepotism and excessive use of pardoning powers. During the temperance movement, critics accused the governor of drunkenness, which he publicly admitted."

Historical Error

Consider traditional multiplication algorithm from the school curriculum. How many single-digit multiplication operations does it require? Suppose you are multiplying I received a check from Knuth for 0x$3.00-digit number I received a check from Knuth for 0x$3.00 to I received a check from Knuth for 0x$3.00-digit I received a check from Knuth for 0x$3.00. First, multiply the first digit I received a check from Knuth for 0x$3.00 by each digit I received a check from Knuth for 0x$3.00 in turn. Then multiply the second digit I received a check from Knuth for 0x$3.00 by each digit I received a check from Knuth for 0x$3.00 in turn and so on, until you have gone through all the digits I received a check from Knuth for 0x$3.00. Thus, traditional multiplication requires I received a check from Knuth for 0x$3.00 primitive multiplications. Specifically, multiplying two numbers by I received a check from Knuth for 0x$3.00 digits requires I received a check from Knuth for 0x$3.00 single-digit multiplications.

This is not ideal, but the process can be optimized using a method developed by Soviet mathematician Anatoly Alexeyevich Karatsuba. Suppose that I received a check from Knuth for 0x$3.00 and I received a check from Knuth for 0x$3.00 - are two-digit decimal numbers; that is, there exist numbers I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00 such that I received a check from Knuth for 0x$3.00 and I received a check from Knuth for 0x$3.00 (generalizing this algorithm to larger digits requires certain manipulations; while this is not too complicated, to avoid mistakes in the details, I would prefer to stick to a simple example). Then I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00. Multiplying binomials gives I received a check from Knuth for 0x$3.00. At this point, we still have I received a check from Knuth for 0x$3.00 single-digit multiplications: I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00, I received a check from Knuth for 0x$3.00. Now let's add and subtract I received a check from Knuth for 0x$3.00After several rearrangements, which I will leave as an exercise for the reader, it results in I received a check from Knuth for 0x$3.00 — only three single-digit multiplications! (There are some constant coefficients, but they can only be computed by addition and bit shifting).

Don't ask for proof, but the Karatsuba algorithm (recursively generalized from the example above) improves the traditional method of multiplication from I received a check from Knuth for 0x$3.00 operations down to I received a check from Knuth for 0x$3.00. Note that this is a real improvement of the algorithm, not an optimization for mental calculations. Indeed, the algorithm is not suitable for mental arithmetic as it incurs significant overhead for recursive operations. Moreover, the effect will not materialize fully until the numbers are sufficiently large (fortunately, even faster methods than the Karatsuba algorithm have emerged: in March 2019, an algorithm was published that requires only n log n multiplications; the acceleration only applies to unimaginably large numbers).

This algorithm is described on page 295 of the second volume of "The Art of Computer Programming". There, Knuth writes: "Interestingly, this idea was discovered only in 1962 year", when a paper describing the Karatsuba algorithm was published. But! In 1995, Karatsuba published a paper titled "Complexity of Computation", where he mentions several things: 1) around 1956, Kolmogorov suggested that multiplication cannot be carried out in less than I received a check from Knuth for 0x$3.00 steps; 2) in 1960 year, Karatsuba attended a seminar where Kolmogorov presented his hypothesis n². 3) "Exactly one week later" Karatsuba developed the "divide and conquer" algorithm; 4) in 1962, Kolmogorov wrote and published a paper on behalf of Karatsuba describing the algorithm. "I only learned about this article after it was reprinted."

Thus, the mistake lies in the fact that instead of 1962 the year should have been specified. 1960 That's all.

Analysis

Finding errors didn't require particular skill.

  1. The first mistake was as trivial as possible and was located in a relatively obvious place (the beginning of the chapter). Any idiot would have found it; I just happened to be that idiot.
  2. Finding the second typo required luck and diligence, but not skill. The index for "Williams" is located on the penultimate page of the volume, a fairly conspicuous part of the book. I was just flipping through the index (it's not as painful as it seems, because there are Easter eggs hidden in Knuth's indexes. For instance, there are entries in Arabic and Hebrew, and both point to page 66. But neither language is mentioned on that page; instead, it talks about "languages that read right to left"). And my attention was caught by the second name. As I usually read Wikipedia, I checked Robin Williams and noticed a discrepancy.
  3. I wish I could say that I conducted serious research to find a historical error, but in reality, I just looked at the Wikipedia page on the Karatsuba algorithm.In the very first lines, it states: "The Karatsuba algorithm is a fast multiplication algorithm. Discovered by Anatoly Karatsuba in 1960 and published in 1962." After that, it was just a matter of adding two and two.

In the future, I would like to find a more significant error, especially in Knuth's code. I would also like to find a bug in the first volume of "The Art of Computer Programming". Perhaps I would have, but for some reason, the local library only has volumes 2, 3, and 4A.

Financial facts:

  • In total, my contribution to TAOCP consists of just three symbols: one addition tr1 != str2, one replacement. m to n and 2 to 0At a price of $2.56, these are quite profitable symbols; if you were paid such a rate, an article of 1,000 words (on average, about four symbols) would net you ten grand.
  • With three hexadecimal dollars, I share 69th place on the list of the richest depositors of the San Serriffe bank with 29 other citizens (as of May 1, 2019).

Further discussions on checks from Knuth

  • How to obtain a check from Knuth

    General recommendations for finding errors in Knuth's books. Mainly concern technical errors, which I do not have. There is one statement I took seriously:

    It's better to wait until you’ve gathered a set of errors to send. By combining a few real, but not very significant mistakes, you’ll increase the likelihood that one of them will actually be regarded as an error or suggestion. If you send errors one by one, each may be rejected.

    I didn't want to send just silly typos, but I took the advice and only sent the letter when I found a historical error that seemed serious enough.

  • Checks of Ashutosh Mehra

    Ashutosh Mehra is the third wealthiest contributor in San-Serif with a colossal fortune of 0x$207,f0 in BoSS.

  • Check for some non-functional errors in the real TeX code
  • Miscellaneous: #1 #2 #3 #4 #5 #6

Source: habr.com

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster