% CHANGES TO VOLUME 2 OF THE ART OF COMPUTER PROGRAMMING % % Copyright (C) 2011, 2012, 2013 by Donald E. Knuth % This file may be freely copied provided that no modifications are made. % All other rights are reserved. % % Three levels of changes to the books are distinguished here: % % "\bugonpage" introduces the correction of an error; % "\amendpage" introduces new material for future editions; % "\improvepage" introduces ameliorations of lesser importance. % % (Changes introduced by \improvepage do not appear in the hardcopy listing.) % % Also, "\planforpage" introduces some of the author's half-baked intentions. % % NOTE: TO PUT THE INDEX ON A SEPARATE PAGE, RUN THIS WITH THE COMMAND LINE % tex "\let\indexeject+ \input err2" \newif\ifall % \alltrue means show the trivial items too \relax % hook \def\vertical{|} \def\inref#1 #{\expandafter\def\csname\vertical#1\endcsname} \catcode`|=\active \let|\inref \input \jobname.ref \catcode`|=12 \input taocpmac % use the format for TAOCP, with modifications below \def\becomes{\ifmmode\ \hbox\fi{\manfnt y}\ } % wiggly arrow indicates a change \def\bugonpage#1.#2 #3 (#4) { \medbreak\defaultpointsize \line{\kern-5pt\llap{\manfnt x}% print a black triangle in left margin {\bf Page #2}\enspace #3 \leaders\hrule\hfill\ \eightrm\date#4.} \nobreak\smallskip\iftrue\noindent} \def\amendpage#1.#2 #3 (#4) { \medbreak\defaultpointsize \line{\kern-5pt{\bf Page #2}\enspace #3 \leaders\hrule\hfill\ \eightrm\date#4.} \nobreak\smallskip\iftrue\noindent} \def\improvepage#1.#2 #3 (#4) {\ifall \medbreak\ninepoint \line{\kern-6pt{\sl Page #2\enspace #3\/} \leaders\hrule\hfill\ \eightrm\date#4.} \nobreak\smallskip\noindent} \def\planforpage#1.#2 #3 (#4) { \medbreak\defaultpointsize \line{\kern-5pt{\bf Page #2}\enspace #3 \leaders\hbox to 5pt{\hss.\hss}\hfill\ \eightrm\date#4.} \nobreak\smallskip\begingroup\let\endchange=\endgroup\sl\noindent} \let\endchange=\fi \def\nl{\par\noindent} \def\nlh{\par\noindent\hangit} \def\hangit{\hangindent2em} \def\cutpar{{\parfillskip=0pt\par}} \def\date#1.#2.#3.{% convert "yy.mm.dd." to "dd Mon 19yy" #3 \ifcase#2\or Jan\or Feb\or Mar\or Apr\or May\or Jun\or Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi \ \ifnum #1<97 \hundred#1\else19#1\fi} \def\hundred{20} % the "century" for dates before '97 \def\ex #1. [#2]{\ninepoint \textindent{\bf#1.}[{\it#2\/}]\kern6pt} \def\EX #1. [#2]{\ninepoint \textindent{\llap{\manfnt x}\bf#1.}[{\it#2\/}]\kern6pt} \def\foottext#1{\medskip \hrule height\ruleht width5pc \kern-\ruleht \kern3pt \eightpoint \smallskip\textindent{#1}} \def\volheadline#1{\line{\cleaders\hbox{\raise3pt\hbox{\manfnt\char'36}}\hfill \titlefont\ #1\ \cleaders\hbox{\raise3pt\hbox{\manfnt\char'36}}\hfill}} \def\refin#1 {\let|\inref \input #1.ref \let|\crossref} \let\defaultpointsize=\tenpoint %%%%%%%%%%%%%% opening remarks %%%%%%%%%%%%%%%%%%%%%%%% \def\lhead{INTRODUCTION} \let\rhead=\lhead \titlepage \volheadline{THE ART OF COMPUTER PROGRAMMING} \bigskip \volheadline{ERRATA TO VOLUME 2 (after 2010)} \bigskip \noindent This document is a transcript of the notes that I have been making in my personal copy of {\sl The Art of Computer Programming}, Volume~2 (third edition, 26th printing) since it was first printed in 2011. Previous errata are recorded in another file `{\tt all2-pre.ps}'. \ifall Four levels of updates\dash---``errors,'' ``amendments,'' ``plans,'' and ``improvements''\dash---appear, indicated by four \else Three levels of updates\dash---``errors,'' ``amendments,'' and ``plans''\dash---appear, indicated by three \fi different typographic conventions: \begingroup\def\hundred{17} \bugonpage 0.666 line 1 (76.07.04) Technical or typographical errors (aka bugs) are the most critical items, so they are flagged with a `\thinspace{\manfnt x}\thinspace' preceding the page number. The date on which I first was told about the bug is shown; this is the effective date on which I paid the finder's fee. The necessary corrections are indicated in a straightforward way. If,~for example, the book says `$n$' where it should have said `$n+1$', the change is shown thus: \smallskip $n$ \becomes $n+1$ \endchange \amendpage 0.666 line 2 (89.07.14) Amendments to the text appear in the same format as bugs, but without the~`\thinspace{\manfnt x}\thinspace'. These are things I wish I had known about or thought of when I wrote the original text, so I added them later. The date is the date I drafted the new text. \endchange \def\hundred{19} \planforpage 0.666 line 3 (17.11.20) Plans for the future represent a third kind of item. In such notes I~sketched my intentions about things that I wasn't ready to flesh out further when I~wrote them down. You can identify these items because they're written in slanted type, and preceded by a bunch of dots `\hbox to 6em{\leaders\hbox to 5pt{\hss.\hss}\hfill}' leading to the date on which I recorded the plan in my files. \endchange \improvepage 0.666 line 4 (38.01.10) The fourth and final category\dash---indicated by page and line number in smaller, slanted type\dash---consists of minor corrections or improvements that most readers don't want to know about, because they are so trivial. You wouldn't even be seeing these items if you hadn't specifically chosen to print the complete errata list in all its gory details. Are you sure you wanted to do that? \endchange \endgroup \ifall\else\medskip\ninepoint My personal file of updates also includes a fourth category of items, not shown in this list. They are miscellaneous minor corrections or improvements that most readers don't want to know about, because they are so trivial. If you really want to see all of the gory details, you can download the full list from Internet webpage $$\.{http://www-cs-faculty.stanford.edu/\char`\~knuth/taocp.html}$$ by selecting the ``long form'' of the errata. \fi \medskip \tenpoint My shelves at home are bursting with preprints and reprints of significant research results that I want to digest and summarize, where appropriate, in the ultimate edition of Volume~2. I didn't do that in the third edition because I would surely have to do it over again later: New results continue to pour forth at a great rate, and I will have time to rewrite that volume only~once. Volumes 4 and~5 need to be finished first. So I've put most of my effort so far into writing up those parts of the total picture that seem to have converged to their near-final form. It follows, somewhat paradoxically, that the updates in this document are most current in the areas where there has been least activity. On the other hand I do believe that the changes listed here bring Volume~2 completely up to date in two respects: (1)~All of the research problems in the previous edition\dash---i.e., all exercises that were rated 46 and above\dash---have received new ratings of 45 or less whenever I learned of a solution; and in such cases, the answer now refers to that solution. (2)~All of the historical information about pioneering developments has been amended whenever new details have come to my attention. \beginconstruction The ultimate, glorious, 100\% perfect editions of Volumes 1--4A are works in progress. Please let me know of any improvements that you think I ought to make. Send your comments either by snail mail to D.~E. Knuth, Computer Science, Gates Building 4B, Stanford University, Stanford CA~94305-9045, or by email to {\tt taocp{\char`\@}cs.stanford.edu}. (Use email for book suggestions only, please\dash---all other correspondence is returned unread to the sender, or discarded, because I have no time to read ordinary email.) Although I'm working full time on Volume~4B these days, I~will try to reply to all such messages within a year of receipt. Current news about {\sl The Art of Computer Programming\/} is posted on $$\.{http://www-cs-faculty.stanford.edu/\char`~knuth/taocp.html}$$ and updated regularly. \par\endconstruction \rightline{\dash---Don Knuth, January 2011} \bigskip \bigskip {\quoteformat Oh! If only someone would give me time, time, time to do everything\/ {\rm properly}, to read everything at\/ {\rm my own\/} tempo, to take it apart and put it together again. \author KARL BARTH (1922) % letter to Edvard Thurneysen, spring 1922 % found in Revolutionary Theology in the Making: Barth-Thurneysen % Correspondence 1914--1925, tr by Jas. D. Smart % Richmond VA: John Knox Press, 1964, p43 \vfill\eject } \def\today{\number\day\space\ifcase\month\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi \space\number\year} %%%%%%%%%%%%%%% CHANGES FOR VOLUME 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\lhead{CHANGES TO VOLUME 2: SEMINUMERICAL ALGORITHMS} \let\rhead=\lhead \titlepage \volheadline{SEMINUMERICAL ALGORITHMS} \bigskip \rightline{Copyright \copyright\ 2011, 2012, 2013 Addison\with Wesley; all rights reserved} \rightline{Last updated \today} \bigskip \rightline{\sl Most of these corrections have already been made in recent printings.} \smallskip \let\defaultpointsize=\tenpoint \amendpage 2.x line 16 (11.06.16) a {\it 45\/} rating \becomes a {\it 40\/} rating \endchange \amendpage 2.x line 20 (13.01.30) creativity.\ \becomes creativity. All exercises with ratings of {\it46\/} or more are open problems for future research, rated according to the number of different attacks that they've resisted so far. \endchange \improvepage 2.13 lines 1 and 2 (11.09.15) overflow will be on after program \eq(2) if and only if the result equals~$w$ \becomes the result equals $w$ if and only if program~\eq(2) turns overflow on \endchange \amendpage 2.117 line $-4$ (13.04.02) \ninepoint [\HM47] (I. Borosh.) \becomes [\HM48] (I. Borosh and H. Niederreiter.) \endchange \improvepage 2.145 line 25 (12.02.23) Let $X_1$, $X_2$, \dots, $X_t$ be a set \becomes Let $(X_1,X_2,\ldots,X_t)$ be a sequence \endchange \amendpage 2.189 a new quotation to insert before the exercises (13.02.06) {\quoteformat Almost all good computer programs contain at least one random-number generator. \author DONALD E. KNUTH, {\sl Seminumerical Algorithms\/} (1969) % first edition p157 } \endchange \bugonpage 2.196 line $-11$ (11.06.08) Pratiche del calcolo \becomes Pratiche di calcolo \endchange \bugonpage 2.200 line 20 (13.01.24) an appendix to his little book {\sl Rhabdologia\/} \becomes part three of his little book {\sl Rabdologi\ae\/} \endchange \bugonpage 2.200 line $-15$ (11.09.13) K. Gehrhardt \becomes C. I. Gerhardt \endchange \bugonpage 2.275 line 19 (11.04.04) $235@M$ \becomes $23.5@M$ \endchange \amendpage 2.280 line 26 (13.03.08) Stay tuned for new records as we move into a new millennium. \becomes By 2011 the world record had risen to ten {\it trillion\/} digits(!), obtained by A.~J. Yee and S.~Kondo using the Chudnovsky formula together with exercise~39. \endchange \amendpage 2.293 line 4 of exercise 13 (12.11.26) {\bf 218} \becomes {\bf 218},\thinspace1 \endchange \amendpage 2.311 line $-5$ (11.03.02) (1988) \becomes (International Supercomputing Institute, 1988) \endchange \amendpage 2.367 replacement for line $-8$ (11.09.18) Furthermore $r_n\le\vert{\cal I}\cap P_n\vert\le r_n+t_n$, because ${\cal I}_N\subseteq{\cal I}\subseteq{\cal I}_N\cup{\cal K}$. Consequently \endchange \amendpage 2.367 replacement for line $-5$ (11.09.18) Given $\epsilon$, this holds for all $n$; so $\lim_{@n\to \infty } r_n/n = \lim_{@n\to \infty } (r_n+t_n)/n = \mu ({\cal I})$.\quad\slug\tighten \endchange \amendpage 2.382 replacement for {\eq(5)} (11.12.09) $$\pi(x)\;\approx\;\sum_{k=1}^{\lg x} {\mu(k)\over k}L\bigl(\!\root k\of x\,\bigr) \;=\; L(x) - {1\over2}L\bigl(\sqrt x\,\bigr) - {1\over3}L\bigl(\root3\of x\,\bigr) + \cdots \eqno (5)$$ \endchange %\amendpage 2.395 line 8 (12.10.23) %$1%% unicode char "8fd1 \JC48:48:0:40% J3803 <0000c00c00000000f00f00000000f80f800c0000f00f001effffffffffff7fffffffffff% 0000f00f00000000f00f00000000f00600000000600000000c06000c03000f0f3e0f07c0% 0fff8f8f8fe00fff87cf1f800f0f07ef3e000f0f03ef38000f0f01cf60300f0f000f0078% 0f0f3ffffffc0f0f1ffffffc0f0f001f60000f0f003e70000fff003e300c0fff007c381e% 0f0fffffffff0f0f7fffffff0f0f01f00f800f0f03e607c00f0f07c787f80f0f0f07c3ff% 0f0f1fe7c1ff0f0f39f784ff0fffe0ff8e7f0fff00ff9f1e0f0f007fbf800f0f0037f000% 1f0f000780001e0f000780001e0f003ff0001e0f03f7be001c0f1fe79f803c0f0fc78fc0% 380f0f878fe0381f060787e031ff043f83e0707e001f81c0603e000f8000c01c00070000% >%% unicode char "85e4 \JC48:48:0:40% J4448 <0001800600000001e00780000001f007c0000001f007c0000001e007800c0001e007801e% ffffffffffff7fffffffffff0001e00780000001e00780000001e00780000001e0078000% 0000c003000000000003c00000001c00f00000001f00780000001e007c0000001f007e00% 00000f003e0006000f803e1807800f800c3c07fffffffffe07fffffffffe078007c00000% 078003e00000078003e01800078001f01e00078001f03f80078001f83f00078000f87e00% 078000fc7c000780007cf8000780003ff0040780003fe0040780001fe0040780000fc00c% 0780000fc00c0780001fe00c0780003ff01c0700007ff81c0f0000fcfe1e0e0001f87f9e% 1e0007e03fff1c000fc01fff38003f0007ff3800fc0003fe7007c000007cc00000000000% >%% unicode char "8302 ), 280. % 30th Kontorovich, Alex Vladimir ({\rus Kontorovich, Aleksandr Vladimirovich}), 584. % 30th Lalescu, Gheorghe Liviu, 186. % 28th Left multiple, least common, 437--438. % 29th MacMillan, Donald Bashford, 226. % 30th Mairan, Jean-Jacques d'Ortous de, 537. % 30th Maupertuis, Pierre-Louis Moreau de, 537. % 30th Moivre, Abraham de, 537. % 30th Number field sieve, 403, 671. %29th Right divisor, greatest common, 437--438. % 29th Stirling, James, 537. % 30th Vassilevska Williams, Virginia Panayotova ({\rus Vasilevska, Virginiya Panai0otova}), 717. % 29th Ville, Jean Andr\'e, 597. % 29th Wald, Abraham (= \'Abrah\'am), 163, 177--178. % 30th Williams, Virginia Panayotova Vassilevska ({\rus Virginiya Panai0otova Vasilevska}), 717. % 29th Yee, Alexander Jih-Hing (\GC79:80:-1:64% G5164 <000000001e0000000000000000001f8000000000000000003fc000000000000000003ff0% 00000000000000007ff000000000000000007ff00000000000000000ffe0000000000000% 0000fff00000000000000001ff780000000000000001fc7c0000000000000003f83c0000% 000000000003f83e0000000000000007f01f000000000000000fe01f000000000000001f% c00f800000000000001f800fc00000000000003f8007f00000000000007f0007f8000000% 000000fe0003fc000000000001fc0001fe000000000003f80000ff800000000003f00000% ffc00000000007e000007ff0000000000fc000003ff8000000001fc000001ffe00000000% 3f80000007ff000000007f00000003ffc0000000fe0000000fffe0000001fc0000001fff% fc000001f80000003fbfff800003f00000007fdfffe00007ffffffffffe7fffc000f8fff% ffffffe3fffe001f04001f800000fff8003e00001f8000003ff000fc00001f8000000fc0% 01f800001f800000078007e000001f80000001000fc000001f80000000001f0000001f80% 000000007e0000001f8000070000f80000001f80000f8000f00000001f80001fc000c000% 00001f80003fc000007fffffffffffffe000003ffffffffffffff000003fffffffffffff% f000000000001f8000000000000000001f8000000000000000001f8000000000000001c0% 1f8000000000000001e01f8000000000000003f81f8380000000000003fc1f87e0000000% 000007fe1f83f8000000000007fe1f81fe00000000000ffc1f807f00000000000ff81f80% 3fc0000000001fc01f801ff0000000003f801f800ffc000000007f801f8007ff00000000% 7f001f8003ff80000000fe001f8001ffe0000001fc001f8000fff0000003fc001f80007f% f8000007f8001f80003ff800001ff0001f80001ffc00003fc0001f80000ffc00007f8000% 1f800007fc0000ff0fe01f800003fe0003fc1ffc1f800003fe0007f803ffff800001fe00% 1fe000ffff800000fc003f00003fff800000fc003c00001fff800000700010000007ff80% 0000000010000003ff000000000000000003fe000000000000000001f800000000000000% 0001f00000000000>%% unicode "4f59 \GC72:79:-2:63% G5439 <0003c00000000000000003f80000000000000003f80000000000000007f8000000000000% 0007f80000000000000007f00000000000000007f00007000000700007e0000f83c000f8% 0007e0001fc3f801fc000f80003fe3fffffe000ffffffff3ffffff001ffffffffbffffff% 001ffffffffbe0007e003e03f00003e0007c003c03f00003e0007c007c03f00003e0007c% 007c07f00003e0007c00f807f00003e0007c01f007f00383e0007c01e007f007c3e0007c% 038007f00fe3e0007c030007e01ff3e0007c7ffffffffffbe0007c3fffffffffffe0007c% 1fffffffffffe0007c000007e00003e0007c000007c00003e0007c000007f00003e0007c% 000007fc0003e0007c00000fff0003e0007c00000fbfc003e0007c00001f1ff003e0007c% 00001f07fc03fffffc00003e03fe03fffffc00007e00ff83fffffc0000fc007f83e0007e% 0001fc003f87e0007e0003f8001fc7e0007e0007f0000fc7e0007e000fe00007c7e0007e% 003fc00007c7e0007c00ff1c000307e0e00003fe1e00000001f0000ff81f80000003f800% 3fe01ffffffffffc00ff801ffffffffffe00fe001ffffffffffe0040001f80000001fc00% 00000f80000001f80000000f80000001f80000000f80000001f80000000f80000001f800% 00000f80000001f80000000f80000001f80000000f80000001f80000000f80000001f800% 00000f80000001f80000000ffffffffff80000000ffffffffff80000000f80000001f800% 00000f80000001f80000000f80000001f80000000f80000001f80000000f80000001f800% 00000f80000001f80000000f80000001f80000000f80000001f80000000f80000001f800% 00001f80000001f80000001ffffffffff80000001ffffffffff80000001ffffffffffc00% 00001f80000001fc0000001f80000001fc0000003f80000001fc0000003f80000001fc00% 00003f80000001fc0000003f00000001f80000003f00000001f800>%% unicode "667a \GC78:78:-1:63% G2667 <000e0000000000000000000fc000000000000000000ff000000000000000000ff8000000% 00000000000ff800000000000000000ff000000000000e00000fe000000000003f00000f% c000000000007f80000fc00000000000ffc0000fc03fffffffffffe0000fc01fffffffff% fff0000fc00ffffffffffff0000fc00e000000000000000fc000000000000000000fc000% 000000000000000fc000000000000000000fc000000000000000000fc000000000000000% 000ff800700000078000000fff007800000fc000000fffc07e00000fe000020fdfe07f00% 001ff000030fcff07ffffffff800030fc7f87ffffffffc00030fc3f87ffffffffc00038f% c1fc7e00000ff000038fc1fc7e00000fc000078fc0fc7e00000fc000078fc0fc7e00000f% c0000f8fc0787e00000fc0000f8fc0707e00000fc0001f8fc0007e00000fc0001f8fc000% 7e00000fe0003f0fc0007e00000fe0007f0fc0007e00000fe000ff0fc0007e00000fe000% ff0fc0007e00000fe0007f0fc0007e00000fe0007f0fc0007fffffffe0003c0fc0007fff% ffffe000000fc0007e00000fe000000fc0007e00000fe000000fc0007e00000fe000000f% c0007e00000fe000000fc0007e00000fe000000fc0007e00000fe000000fc0007e00000f% e000000fc0007e00000fe000000fc0007e00000fe000000fc0007e00000fe000000fc000% 7e00000fe000000fc0007e00000fe000000fc0007e00000fe000000fc0007e00000fe000% 000fc0007fffffffe000000fc0007fffffffe000000fc0007fffffffe000000fc0007e00% 000fe000000fc0007e00000fe000000fc0007e00000fc000000fc0007e00000fc000000f% c0007c0000000000000fc0007c0000000000000fc000000000000000000fc00000000000% 0380000fc0000000000007c0000fc000000000000fe0000fc000000000001ff0000fc000% 000000003ff8000fcffffffffffffffc000fc7fffffffffffffc000fc200000000000000% 000fc000000000000000000fc000000000000000001fc000000000000000001fc0000000% 00000000001fc000000000000000001e0000000000000000>%% unicode "6052 ), 280. % 30th \vfill \enddoublecolumns \endchange \bye [The next printing will be the 30th.] not listed above: pages 184--189 revised to accommodate a new quote; (v) on p 185 shortened the index entries for Ferrenberg, Knuth, and Pitfalls are affected index entry for Jacobi loses page 435 ARTICLES "TO APPEAR" THAT ARE STILL PENDING: Virginia's paper on matrix multiplication