The Art of Computer Programming: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Planned: Pre-fascicle link
imported>Hexware
phrasing
 
Line 18: Line 18:
| isbn        = 0-201-03801-3
| isbn        = 0-201-03801-3
}}
}}
'''''The Art of Computer Programming''''' ('''''TAOCP''''') is a comprehensive multi-volume [[monograph]] written by the computer scientist [[Donald Knuth]] presenting [[Computer programming|programming]] [[algorithm]]s and [[analysis of algorithms|their analysis]]. {{As of|2025}} it consists of published volumes 1, 2, 3, 4A, and 4B, with more expected to be released in the future. The Volumes 1–5 are intended to represent the central core of computer programming for sequential machines; the subjects of Volumes 6 and 7 are important but more specialized.<ref>{{cite web |url=https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |title=Kuth's note about his books |access-date=2025-03-28  |archive-date=2025-03-01  |archive-url=https://web.archive.org/web/20250301062919/https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |url-status=live }}</ref>
'''''The Art of Computer Programming''''' ('''''TAOCP''''') is a comprehensive multi-volume [[monograph]] written by the computer scientist [[Donald Knuth]] presenting [[Computer programming|programming]] [[algorithm]]s and [[analysis of algorithms|their analysis]]. {{As of|2025}} it consists of published volumes 1, 2, 3, 4A, and 4B, with more expected to be released in the future. The Volumes 1–5 are intended to represent the central core of computer programming for sequential machines; the subjects of Volumes 6 and 7 are important but more specialized.<ref>{{cite web |url=https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |title=Knuth's note about his books |access-date=2025-03-28  |archive-date=2025-03-01  |archive-url=https://web.archive.org/web/20250301062919/https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |url-status=live }}</ref>


When Knuth began the project in 1962, he originally conceived of it as a single book with twelve chapters. The first three volumes of what was then expected to be a seven-volume set were published in 1968, 1969, and 1973. Work began in earnest on Volume 4 in 1973, but was suspended in 1977 for work on [[TeX|typesetting]] prompted by the second edition of Volume 2. Writing of the final copy of Volume 4A began in longhand in 2001, and the first online pre-fascicle, 2A, appeared later in 2001.<ref>{{cite web |url=https://oac.cdlib.org/findaid/ark:/13030/kt2k4035s1/entire_text |title=note for box 3, folder 1 |access-date=2019-12-03  |archive-date=2019-12-03  |archive-url=https://web.archive.org/web/20191203042158/https://oac.cdlib.org/findaid/ark:/13030/kt2k4035s1/entire_text/ |url-status=live }}</ref> The first published installment of Volume 4 appeared in paperback as [[Fascicle (book)|Fascicle]] 2 in 2005. The hardback Volume 4A, combining Volume 4, Fascicles 0–4, was published in 2011. Volume 4, Fascicle 6 ("Satisfiability") was released in December 2015; Volume 4, Fascicle 5 ("Mathematical Preliminaries Redux; Backtracking; Dancing Links") was released in November 2019.
When Knuth began the project in 1962, he originally conceived of it as a single book with twelve chapters. The first three volumes of what was then expected to be a seven-volume set were published in 1968, 1969, and 1973. Work began in earnest on Volume 4 in 1973, but was suspended in 1977 for work on [[TeX|typesetting]] prompted by the second edition of Volume 2. Writing of the final copy of Volume 4A began in longhand in 2001, and the first online pre-fascicle, 2A, appeared later in 2001.<ref>{{cite web |url=https://oac.cdlib.org/findaid/ark:/13030/kt2k4035s1/entire_text |title=note for box 3, folder 1 |access-date=2019-12-03  |archive-date=2019-12-03  |archive-url=https://web.archive.org/web/20191203042158/https://oac.cdlib.org/findaid/ark:/13030/kt2k4035s1/entire_text/ |url-status=live }}</ref> The first published installment of Volume 4 appeared in paperback as [[Fascicle (book)|Fascicle]] 2 in 2005. The hardback Volume 4A, combining Volume 4, Fascicles 0–4, was published in 2011. Volume 4, Fascicle 6 ("Satisfiability") was released in December 2015; Volume 4, Fascicle 5 ("Mathematical Preliminaries Redux; Backtracking; Dancing Links") was released in November 2019.
Line 41: Line 41:
In the preface, he thanks first his wife Jill, then Burroughs for the use of B220 and B5500 computers in testing most of the programs, and Caltech, the National Science Foundation, and the Office of Naval Research.<ref name=TAOCP-FA>{{Cite web |last=Knuth |first=Donald Ervin |title=The Art of Computer Programming (TAOCP) 2nd Edition, 1973 |url=https://cs.stanford.edu/~knuth/taocp.html |date=2019-08-03 |access-date=2024-11-26 |archive-date=2019-08-03  |archive-url=https://web.archive.org/web/20190803223145/https://cs.stanford.edu/~knuth/taocp.html |url-status=live }}</ref>{{rp|xii}}
In the preface, he thanks first his wife Jill, then Burroughs for the use of B220 and B5500 computers in testing most of the programs, and Caltech, the National Science Foundation, and the Office of Naval Research.<ref name=TAOCP-FA>{{Cite web |last=Knuth |first=Donald Ervin |title=The Art of Computer Programming (TAOCP) 2nd Edition, 1973 |url=https://cs.stanford.edu/~knuth/taocp.html |date=2019-08-03 |access-date=2024-11-26 |archive-date=2019-08-03  |archive-url=https://web.archive.org/web/20190803223145/https://cs.stanford.edu/~knuth/taocp.html |url-status=live }}</ref>{{rp|xii}}


Section 2.5 of "Fundamental Algorithms" is on [[Dynamic memory allocation|Dynamic Storage Allocation]]. Parts of this are used in the Burroughs approach to memory management. Knuth claims credit for “The “boundary-tag” method, introduced in Section 2.5, was designed by the author in 1962 for use in a control program for the B5000 computer.”{{r|TAOCP-FA|p=460}}
Section 2.5 of "Fundamental Algorithms" is on [[Dynamic memory allocation|Dynamic Storage Allocation]]. Parts of this are used in the Burroughs approach to memory management. Knuth claims credit for: “the “boundary-tag” method, introduced in Section 2.5, was designed by the author in 1962 for use in a control program for the B5000 computer.”{{r|TAOCP-FA|p=460}}


Knuth received support from Richard S. Varga, who was the scientific adviser to the publisher. Varga was visiting [[Olga Taussky-Todd]] and [[John Todd (computer scientist)|John Todd]] at [[Caltech]]. With Varga's enthusiastic endorsement, the publisher accepted Knuth's expanded plans. In its expanded version, the book would be published in seven volumes, each with just one or two chapters.<ref>
Knuth received support from Richard S. Varga, who was the scientific adviser to the publisher. Varga was visiting [[Olga Taussky-Todd]] and [[John Todd (computer scientist)|John Todd]] at [[Caltech]]. With Varga's enthusiastic endorsement, the publisher accepted Knuth's expanded plans. In its expanded version, the book would be published in seven volumes, each with just one or two chapters.<ref>
Line 56: Line 56:
All examples in the books use a hypothetical language called "[[MIX (abstract machine)|MIX]] assembly language" (MIXAL), which runs on "a mythical computer called MIX". Currently,{{when|date=October 2022}} the MIX computer is being replaced by the [[MMIX]] computer, which is a [[RISC]] version. The conversion from MIX to MMIX was a large ongoing project for which Knuth solicited volunteers for help. Software such as [[GNU MDK]]<ref>{{Cite web |title=GNU MDK - GNU Project - Free Software Foundation |url=https://www.gnu.org/software/mdk/mdk.html |access-date=2022-10-23 |website=www.gnu.org |archive-date=2022-10-23  |archive-url=https://web.archive.org/web/20221023050959/https://www.gnu.org/software/mdk/mdk.html |url-status=live }}</ref> exists to provide [[Emulator|emulation]] of the MIX architecture. Knuth considers the use of [[assembly language]] necessary for the speed and memory usage of algorithms to be judged.
All examples in the books use a hypothetical language called "[[MIX (abstract machine)|MIX]] assembly language" (MIXAL), which runs on "a mythical computer called MIX". Currently,{{when|date=October 2022}} the MIX computer is being replaced by the [[MMIX]] computer, which is a [[RISC]] version. The conversion from MIX to MMIX was a large ongoing project for which Knuth solicited volunteers for help. Software such as [[GNU MDK]]<ref>{{Cite web |title=GNU MDK - GNU Project - Free Software Foundation |url=https://www.gnu.org/software/mdk/mdk.html |access-date=2022-10-23 |website=www.gnu.org |archive-date=2022-10-23  |archive-url=https://web.archive.org/web/20221023050959/https://www.gnu.org/software/mdk/mdk.html |url-status=live }}</ref> exists to provide [[Emulator|emulation]] of the MIX architecture. Knuth considers the use of [[assembly language]] necessary for the speed and memory usage of algorithms to be judged.


MIX was much like any computer then in existence, but nicer. The name ‘MIX’ is 1009 in Roman numerals and this is given by a formula involving series numbers of several computers of the time: (360 + 650 + 709 + U3 + SS80 + 1107 + 1604 + G2- + B220 + S2000 + 920 + 601 + H800 + PDP-4 + 11)/16 = 1009 or MIX. The name MMIX is 2009 in Roman numerals and Knuth claims MMIX is even nicer than MIX.
According to Knuth, MIX was much like any computer then in existence, but nicer.<ref>{{cite book|isbn=0201896834|title=Art of Computer Programming, Volume 1, Fundamental Algorithms|first=Donald|last=Knuth|year=1997 |edition=Third|publisher=Addison Wesley Professional |page=124}}</ref> The name 'MIX' is 1009 in Roman numerals and this is given by a formula involving series numbers of several computers of the time: (360 + 650 + 709 + U3 + SS80 + 1107 + 1604 + G2- + B220 + S2000 + 920 + 601 + H800 + PDP-4 + 11)/16 = 1009 or MIX.{{how|date=October 2025|reason=How computers with letters are "added" is unexplained.}} The name MMIX is 2009 in Roman numerals and Knuth claims MMIX is even nicer than MIX.


==Critical response==
==Critical response==
Line 65: Line 65:
===Completed===
===Completed===
* Volume 1&nbsp;– Fundamental algorithms
* Volume 1&nbsp;– Fundamental algorithms
** Chapter 1&nbsp;– Basic concepts
** Chapter 1&nbsp;– Basic concepts<ref>{{cite web |url=https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |title=Knuth's future editions Volumes 1-3 |access-date=2025-04-25  |archive-date=2025-04-23  |archive-url=https://web.archive.org/web/20250423130634/https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |url-status=live }}</ref>
** Chapter 2&nbsp;– Information [[data structure|structures]]
** Chapter 2&nbsp;– Information [[data structure|structures]]
* Volume 2&nbsp;– Seminumerical algorithms
* Volume 2&nbsp;– Seminumerical algorithms
Line 79: Line 79:


===Planned===
===Planned===
* Volume 4C, 4D, ...&nbsp; Combinatorial algorithms (chapters 7 & 8 released in several subvolumes)
* Volume 4C, 4D, ...&nbsp; Combinatorial algorithms (chapters 7 & 8 released in several subvolumes)<ref>{{cite web |last1=D'Agostino |first1=Susan |title=The Computer Scientist Who Can't Stop Telling Stories |url=https://www.quantamagazine.org/computer-scientist-donald-knuth-cant-stop-telling-stories-20200416 |website=Quanta Magazine |access-date=2024-11-26 |date=2020-04-16 |quote="Now 82, he’s hard at work on part B of volume 4, and he anticipates that the book will have at least parts A through F." |archive-date=2024-11-27  |archive-url=https://web.archive.org/web/20241127003657/https://www.quantamagazine.org/computer-scientist-donald-knuth-cant-stop-telling-stories-20200416/ |url-status=live }}</ref>
** Chapter 7&nbsp;– Combinatorial searching (continued)
** Chapter 7&nbsp;– Combinatorial searching (continued)<ref>{{cite book|isbn=9780135328248|title=Art of Computer Programming, Volume 4, Fascicle 7, The: Constraint Satisfaction|first=Donald|last=Knuth|year=2025 |publisher=Addison Wesley Professional }}</ref>
** Chapter 8&nbsp;– [[Recursion]]
** Chapter 8&nbsp;– [[Recursion]]
* Volume 5&nbsp;– Syntactic algorithms
* Volume 5&nbsp;– Syntactic algorithms
** Chapter 9&nbsp;– [[Lexical analysis|Lexical scanning]] (also includes [[String searching algorithm|string search]] and [[data compression]])
** Chapter 9&nbsp;– [[Lexical analysis|Lexical scanning]] (also includes [[String searching algorithm|string search]] and [[data compression]])
** Chapter 10&nbsp;– [[Parsing]] techniques
** Chapter 10&nbsp;– [[Parsing]] techniques
* Volume 6&nbsp;– The Theory of [[context-free language]]s
* Volume 6&nbsp;– The Theory of [[context-free language]]s<ref>{{cite web |url=https://cs.stanford.edu/~knuth/taocp.html#future |title=TAOCP – Future plans |access-date=2018-06-20  |archive-date=2019-08-03  |archive-url=https://web.archive.org/web/20190803223145/https://cs.stanford.edu/~knuth/taocp.html#future |url-status=live }}</ref>
** Chapter 11&nbsp;– [[Mathematical linguistics]]
** Chapter 11&nbsp;– [[Mathematical linguistics]]<ref name="brochure">{{cite web |url=https://cs.stanford.edu/~knuth/brochure.pdf |title=TAOCP – Brochure |access-date=2024-11-26  |archive-date=2024-09-26  |archive-url=https://web.archive.org/web/20240926010938/https://cs.stanford.edu/~knuth/brochure.pdf |url-status=live }}</ref>
* Volume 7&nbsp;– [[Compiler]] techniques
* Volume 7&nbsp;– [[Compiler]] techniques
** Chapter 12&nbsp;– Programming language translation
** Chapter 12&nbsp;– Programming language translation<ref name="brochure" />
 
==Chapter outlines==
===Completed===
====Volume 1&nbsp;– Fundamental algorithms====
* Chapter 1&nbsp;– Basic concepts
** 1.1. [[Algorithm]]s
** 1.2. Mathematical preliminaries
*** 1.2.1. [[Mathematical induction]]
*** 1.2.2. Numbers, powers, and [[logarithm]]s
*** 1.2.3. Sums and products
*** 1.2.4. Integer functions and elementary [[number theory]]
*** 1.2.5. [[Permutation]]s and [[factorial]]s
*** 1.2.6. [[Binomial coefficient]]s
*** 1.2.7. [[Harmonic number]]s
*** 1.2.8. [[Fibonacci number]]s
*** 1.2.9. [[Generating function]]s
*** 1.2.10. Analysis of an algorithm
*** 1.2.11. [[Asymptotic analysis|Asymptotic representations]]
**** 1.2.11.1. The [[Big O notation|O-notation]]
**** 1.2.11.2. [[Euler's summation formula]]
**** 1.2.11.3. Some asymptotic calculations
** 1.3 [[MIX (abstract machine)|MIX]] (Updated with [[MMIX]]<ref>{{cite web |url=https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |title=Kuth's future editions Volumes 1-3 |access-date=2025-04-25  |archive-date=2025-04-23  |archive-url=https://web.archive.org/web/20250423130634/https://www-cs-faculty.stanford.edu/~knuth/taocp.html#future |url-status=live }}</ref> in Volume 1 fascicle 1)
*** 1.3.1. Description of MIX
*** 1.3.2. The MIX assembly language
*** 1.3.3. Applications to [[permutation]]s
** 1.4. Some fundamental programming techniques
*** 1.4.1. [[Function (computer programming)|Subroutines]]
*** 1.4.2. [[Coroutine]]s
*** 1.4.3. Interpretive routines
**** 1.4.3.1. A MIX simulator
**** 1.4.3.2. Trace routines
*** 1.4.4. [[Input/output|Input and output]]
*** 1.4.5. History and bibliography
* Chapter 2&nbsp;– Information structures
** 2.1. Introduction
** 2.2. [[List (abstract data type)|Linear lists]]
*** 2.2.1. [[Stack (abstract data type)|Stacks]], [[Queue (abstract data type)|queues]], and [[Double-ended queue|deques]]
*** 2.2.2. Sequential allocation
*** 2.2.3. Linked allocation ([[topological sorting]])
*** 2.2.4. Circular lists
*** 2.2.5. Doubly linked lists
*** 2.2.6. [[Array (data structure)|Arrays]] and orthogonal lists
** 2.3. [[Tree (data structure)|Trees]]
*** 2.3.1. Traversing [[binary tree]]s
*** 2.3.2. Binary tree representation of trees
*** 2.3.3. Other representations of trees
*** 2.3.4. Basic mathematical properties of trees
**** 2.3.4.1. Free trees
**** 2.3.4.2. [[Polytree|Oriented trees]]
**** 2.3.4.3. [[Kőnig's lemma|The "infinity lemma"]]
**** 2.3.4.4. Enumeration of trees
**** 2.3.4.5. Path length
**** 2.3.4.6. History and bibliography
*** 2.3.5. Lists and [[Garbage collection (computer science)|garbage collection]]
** 2.4. Multilinked structures
** 2.5. [[Dynamic memory allocation|Dynamic storage allocation]]
** 2.6. History and bibliography
 
====Volume 2&nbsp;– Seminumerical algorithms====
* Chapter 3&nbsp;– [[Random number]]s
** 3.1. Introduction
** 3.2. [[Pseudo-random number generator|Generating uniform random numbers]]
*** 3.2.1. The [[Linear congruential generator|linear congruential]] method
**** 3.2.1.1. Choice of modulus
**** 3.2.1.2. Choice of multiplier
**** 3.2.1.3. Potency
*** 3.2.2. Other methods
** 3.3. Statistical tests
*** 3.3.1. General test procedures for studying random data
*** 3.3.2. Empirical tests
*** 3.3.3. Theoretical tests
*** 3.3.4. The spectral test
** 3.4. [[Pseudo-random number sampling|Other types of random quantities]]
*** 3.4.1. Numerical distributions
*** 3.4.2. Random sampling and [[Fisher–Yates shuffle|shuffling]]
** 3.5. What Is a [[Random Sequence|random sequence]]?
** 3.6. Summary
* Chapter 4&nbsp;– Arithmetic
** 4.1. [[Positional notation|Positional number systems]]
** 4.2. [[Floating point]] arithmetic
*** 4.2.1. Single-precision calculations
*** 4.2.2. Accuracy of floating point arithmetic
*** 4.2.3. Double-precision calculations
*** 4.2.4. Distribution of floating point numbers
** 4.3. [[Arbitrary-precision arithmetic|Multiple precision arithmetic]]
*** 4.3.1. The classical algorithms
*** 4.3.2. Modular arithmetic
*** 4.3.3. How fast can we multiply?
** 4.4. [[Radix]] conversion
** 4.5. [[Rational number|Rational]] arithmetic
*** 4.5.1. Fractions
*** 4.5.2. The greatest common divisor
*** 4.5.3. Analysis of [[Euclidean algorithm|Euclid's algorithm]]
*** 4.5.4. Factoring into primes
** 4.6. [[Polynomial]] arithmetic
*** 4.6.1. Division of polynomials
*** 4.6.2. Factorization of polynomials
*** 4.6.3. Evaluation of powers ([[addition-chain exponentiation]])
*** 4.6.4. Evaluation of polynomials
** 4.7. Manipulation of [[Power Series|power series]]
 
====Volume 3&nbsp;– Sorting and searching====
* Chapter 5&nbsp;– [[Sorting algorithm|Sorting]]
** 5.1. Combinatorial properties of [[permutation]]s
*** 5.1.1. Inversions
*** 5.1.2. Permutations of a multiset
*** 5.1.3. Runs
*** 5.1.4. Tableaux and involutions
** 5.2. [[Internal sort]]ing
*** 5.2.1. Sorting by insertion
*** 5.2.2. Sorting by exchanging
*** 5.2.3. Sorting by selection
*** 5.2.4. Sorting by merging
*** 5.2.5. Sorting by distribution
** 5.3. Optimum sorting
*** 5.3.1. Minimum-comparison sorting
*** 5.3.2. Minimum-comparison merging
*** 5.3.3. Minimum-comparison selection
*** 5.3.4. Networks for sorting
** 5.4. [[External Sorting|External sorting]]
*** 5.4.1. Multiway merging and replacement selection
*** 5.4.2. The polyphase merge
*** 5.4.3. The cascade merge
*** 5.4.4. Reading tape backwards
*** 5.4.5. The oscillating sort
*** 5.4.6. Practical considerations for tape merging
*** 5.4.7. External radix sorting
*** 5.4.8. Two-tape sorting
*** 5.4.9. Disks and drums
** 5.5. Summary, history, and bibliography
* Chapter 6&nbsp;– [[Search algorithm|Searching]]
** 6.1. Sequential searching
** 6.2. Searching by comparison of [[Unique key|keys]]
*** 6.2.1. Searching an ordered table
*** 6.2.2. Binary tree searching
*** 6.2.3. Balanced trees
*** 6.2.4. Multiway trees
** 6.3. Digital searching
** 6.4. [[Hash table|Hashing]]
** 6.5. Retrieval on secondary keys
 
====Volume 4A&nbsp;– Combinatorial algorithms, Part 1====
* Chapter 7&nbsp;– Combinatorial searching
** 7.1. [[Binary numeral system|Zeros and ones]]
*** 7.1.1. [[Two-element Boolean algebra|Boolean]] basics
*** 7.1.2. Boolean evaluation
*** 7.1.3. [[Bitwise operation|Bitwise]] tricks and techniques
*** 7.1.4. [[Binary decision diagram]]s
** 7.2. Generating all possibilities
*** 7.2.1. Generating basic combinatorial patterns
**** 7.2.1.1. Generating all ''n''-[[tuple]]s
**** 7.2.1.2. Generating all [[permutation]]s
**** 7.2.1.3. Generating all [[combination]]s
**** 7.2.1.4. Generating all [[integer partition]]s
**** 7.2.1.5. Generating all [[Partition of a set|set partitions]]
**** 7.2.1.6. Generating all [[tree (graph theory)|trees]]
**** 7.2.1.7. History and further references
 
====Volume 4B&nbsp;– Combinatorial algorithms, Part 2====
* Chapter 7&nbsp;– Combinatorial searching (continued)
** 7.2. Generating all possibilities (continued)
*** 7.2.2. [[Backtracking|Backtrack programming]]
**** 7.2.2.1. [[Dancing links]] (includes discussion of [[exact cover]])
**** 7.2.2.2. [[Satisfiability]]
 
===Planned===
====Volumes 4C, 4D, 4E, 4F – Combinatorial algorithms====
Source: <ref>{{cite web |last1=D'Agostino |first1=Susan |title=The Computer Scientist Who Can't Stop Telling Stories |url=https://www.quantamagazine.org/computer-scientist-donald-knuth-cant-stop-telling-stories-20200416 |website=Quanta Magazine |access-date=2024-11-26 |date=2020-04-16 |quote="Now 82, he’s hard at work on part B of volume 4, and he anticipates that the book will have at least parts A through F." |archive-date=2024-11-27  |archive-url=https://web.archive.org/web/20241127003657/https://www.quantamagazine.org/computer-scientist-donald-knuth-cant-stop-telling-stories-20200416/ |url-status=live }}</ref>
* Chapter 7&nbsp;– Combinatorial searching (continued)
** 7.2. Generating all possibilities (continued)
*** 7.2.2. [[Backtracking|Backtrack programming]] (continued)
**** 7.2.2.3. [[Constraint Satisfaction Problem|Constraint satisfaction]] (released as Fascicle 7)<ref>{{cite book|isbn=9780135328248|title=Art of Computer Programming, Volume 4, Fascicle 7, The: Constraint Satisfaction|first=Donald|last=Knuth|year=2025}}</ref>
**** 7.2.2.4. [[Hamiltonian path problem|Hamiltonian paths]] and cycles (released as ''[https://cs.stanford.edu/~knuth/fasc8a.ps.gz Pre-fascicle 8A]'')
**** 7.2.2.5. [[Clique problem|Cliques]] (released as ''[https://cs.stanford.edu/~knuth/fasc8b.ps.gz Pre-fascicle 8B]'')
**** 7.2.2.6. Covers ([[vertex cover]], [[set cover problem]], [[exact cover]], [[clique cover]])
**** 7.2.2.7. Squares
**** 7.2.2.8. A potpourri of puzzles (includes [[perfect digital invariant]]) (released as ''[https://cs.stanford.edu/~knuth/fasc9b.ps.gz Pre-fascicle 9B]'')
**** 7.2.2.9. Estimating backtrack costs (chapter 6 of "Selected Papers on Analysis of Algorithms", and Fascicle 5, pp.&nbsp;44−47, under the heading "Running time estimates")(released as ''[https://cs.stanford.edu/~knuth/fasc9c.ps.gz Pre-fascicle 9C]'')
*** 7.2.3. Generating inequivalent patterns (includes discussion of [[Pólya enumeration theorem]]) (see "Techniques for Isomorph Rejection", chapter 4 of "Classification Algorithms for Codes and Designs" by Kaski and Östergård)
** 7.3. [[Shortest path problem|Shortest paths]]
** 7.4. [[Graph algorithms]]
*** 7.4.1. Components and traversal
**** 7.4.1.1. [[Union-find algorithm]]s
**** 7.4.1.2. [[Depth-first search]]
**** 7.4.1.3. Vertex and edge connectivity
*** 7.4.2. Special classes of graphs
*** 7.4.3. [[Expander graph]]s
*** 7.4.4. [[Random graph]]s
** 7.5. Graphs and optimization
*** 7.5.1. Bipartite matching (including [[Maximum cardinality matching|maximum-cardinality matching]], [[stable marriage problem]], [https://cs.stanford.edu/~knuth/ms.html mariages stables])(released as ''[https://cs.stanford.edu/~knuth/fasc14a.ps.gz Pre-fascicle 14A]'')
*** 7.5.2. [[Assignment problem|The assignment problem]]
*** 7.5.3. [[Network flow problem|Network flows]]
*** 7.5.4. Optimum subtrees
*** 7.5.5. Optimum matching
*** 7.5.6. Optimum orderings
** 7.6. Independence theory
*** 7.6.1. Independence structures
*** 7.6.2. Efficient [[matroid]] algorithms
** 7.7. Discrete [[dynamic programming]] (see also [[Transfer-matrix method (statistical mechanics)|transfer-matrix method]])
** 7.8. [[Branch-and-bound]] techniques
** 7.9. Herculean tasks (aka [[NP-hard]] problems)
** 7.10. [[Approximation algorithm|Near-optimization]]
* Chapter 8&nbsp;– [[Recursion]] (chapter 22 of "Selected Papers on Analysis of Algorithms")
 
====Volume 5&nbsp;– Syntactic algorithms====
* Chapter 9&nbsp;– [[Lexical analysis|Lexical scanning]] (includes also [[Knuth–Morris–Pratt algorithm|string search]] and data compression)
* Chapter 10&nbsp;– [[Parsing]] techniques
 
====Volume 6&nbsp;– The theory of context-free languages<ref>{{cite web |url=https://cs.stanford.edu/~knuth/taocp.html#future |title=TAOCP – Future plans |access-date=2018-06-20  |archive-date=2019-08-03  |archive-url=https://web.archive.org/web/20190803223145/https://cs.stanford.edu/~knuth/taocp.html#future |url-status=live }}</ref>====
* Chapter 11&nbsp;– [[Mathematical linguistics]]<ref name="brochure">{{cite web |url=https://cs.stanford.edu/~knuth/brochure.pdf |title=TAOCP – Brochure |access-date=2024-11-26  |archive-date=2024-09-26  |archive-url=https://web.archive.org/web/20240926010938/https://cs.stanford.edu/~knuth/brochure.pdf |url-status=live }}</ref>
 
====Volume 7&nbsp;– Compiler techniques====
* Chapter 12&nbsp;– [[Programming language translation]]<ref name="brochure" />


==English editions==
==English editions==
Line 378: Line 165:


==External links==
==External links==
{{Commonscat}}
* [https://cs.stanford.edu/~knuth/taocp.html Overview of topics] (Knuth's personal homepage)
* [https://cs.stanford.edu/~knuth/taocp.html Overview of topics] (Knuth's personal homepage)
* [https://cs.stanford.edu/~knuth/brochure.pdf Announcement of Volume 1 of 'The Art of Computer Programming']
* [https://cs.stanford.edu/~knuth/brochure.pdf Announcement of Volume 1 of 'The Art of Computer Programming']

Latest revision as of 11:58, 6 October 2025

Template:Short description Script error: No such module "Distinguish". Template:Use mdy dates Script error: No such module "Infobox".Template:Template otherScript error: No such module "Check for unknown parameters".Template:Wikidata image The Art of Computer Programming (TAOCP) is a comprehensive multi-volume monograph written by the computer scientist Donald Knuth presenting programming algorithms and their analysis. Template:As of it consists of published volumes 1, 2, 3, 4A, and 4B, with more expected to be released in the future. The Volumes 1–5 are intended to represent the central core of computer programming for sequential machines; the subjects of Volumes 6 and 7 are important but more specialized.[1]

When Knuth began the project in 1962, he originally conceived of it as a single book with twelve chapters. The first three volumes of what was then expected to be a seven-volume set were published in 1968, 1969, and 1973. Work began in earnest on Volume 4 in 1973, but was suspended in 1977 for work on typesetting prompted by the second edition of Volume 2. Writing of the final copy of Volume 4A began in longhand in 2001, and the first online pre-fascicle, 2A, appeared later in 2001.[2] The first published installment of Volume 4 appeared in paperback as Fascicle 2 in 2005. The hardback Volume 4A, combining Volume 4, Fascicles 0–4, was published in 2011. Volume 4, Fascicle 6 ("Satisfiability") was released in December 2015; Volume 4, Fascicle 5 ("Mathematical Preliminaries Redux; Backtracking; Dancing Links") was released in November 2019.

Volume 4B consists of material evolved from Fascicles 5 and 6.[3] The manuscript was sent to the publisher on August 1, 2022, and the volume was published in September 2022.[4] Fascicle 7 ("Constraint Satisfaction"), planned for Volume 4C, was the subject of Knuth's talk on August 3, 2022[5] and was published on February 5, 2025.[6]

History

File:KnuthAtOpenContentAlliance.jpg
Donald Knuth in 2005

After winning a Westinghouse Talent Search scholarship, Knuth enrolled at the Case Institute of Technology (now Case Western Reserve University), where his performance was so outstanding that the faculty voted to award him a master of science upon his completion of the bachelor's degree. During his summer vacations, Knuth was hired by the Burroughs Corporation to write compilers, earning more in his summer months than full professors did for an entire year.[7] Such exploits made Knuth a topic of discussion among the mathematics department, which included Richard S. Varga.

In January 1962, when he was a graduate student in the mathematics department at Caltech, Knuth was approached by Addison-Wesley to write a book about compiler design, and he proposed a larger scope. He came up with a list of twelve chapter titles the same day. In the summer of 1962 he worked on a FORTRAN compiler for UNIVAC, considering that he had "sold my soul to the devil" to develop a FORTRAN compiler[8]Template:Rp after ALGOL developments with Burroughs. He remained as a consultant to Burroughs over the period 1960 to 1968 while writing Volume 1 "Fundamental Algorithms".

During this time, he also developed a mathematical analysis of linear probing, which convinced him to present the material with a quantitative approach. After receiving his Ph.D. in June 1963, he began working on his manuscript, of which he finished his first draft in June 1965, at Template:Val hand-written pages.[9] He had assumed that about five hand-written pages would translate into one printed page, but his publisher said instead that about <templatestyles src="Fraction/styles.css" />1+12 hand-written pages translated to one printed page. This meant he had approximately Template:Val printed pages of material, which closely matches the size of the first three published volumes.

The first volume of "The Art of Computer Programming", "Fundamental Algorithms", took five years to complete between 1963 and 1968 while working at both Caltech and Burroughs.

Knuth's dedication in Volume 1 reads:

This series of books is affectionately dedicated
to the Type 650 computer once installed at
Case Institute of Technology,
in remembrance of many pleasant evenings.[lower-alpha 1]

In the preface, he thanks first his wife Jill, then Burroughs for the use of B220 and B5500 computers in testing most of the programs, and Caltech, the National Science Foundation, and the Office of Naval Research.[10]Template:Rp

Section 2.5 of "Fundamental Algorithms" is on Dynamic Storage Allocation. Parts of this are used in the Burroughs approach to memory management. Knuth claims credit for: “the “boundary-tag” method, introduced in Section 2.5, was designed by the author in 1962 for use in a control program for the B5000 computer.”Template:R

Knuth received support from Richard S. Varga, who was the scientific adviser to the publisher. Varga was visiting Olga Taussky-Todd and John Todd at Caltech. With Varga's enthusiastic endorsement, the publisher accepted Knuth's expanded plans. In its expanded version, the book would be published in seven volumes, each with just one or two chapters.[11] Due to the growth in Chapter 7, which was fewer than 100 pages of the 1965 manuscript, per Vol. 4A p. vi, the plan for Volume 4 has since expanded to include Volumes 4A, 4B, 4C, 4D, and possibly more.

In 1976, Knuth prepared a second edition of Volume 2, requiring it to be typeset again, but the style of type used in the first edition (called hot type) was no longer available. In 1977, he decided to spend some time creating something more suitable. Eight years later, he returned with TEX, which is currently used for all volumes.

Another characteristic of the volumes is the variation in the difficulty of the exercises including a numerical rating varying from 0 to 50, where 0 is trivial, and 50 is an open question in contemporary research.

Bounty for finding errors

The offer of a so-called Knuth reward check worth "one hexadecimal dollar" (100HEX base 16 cents, in decimal, is $2.56) for any errors found, and the correction of these errors in subsequent printings, has contributed to the highly polished and still-authoritative nature of the work, long after its first publication.

Assembly language in the book

All examples in the books use a hypothetical language called "MIX assembly language" (MIXAL), which runs on "a mythical computer called MIX". Currently,Template:When the MIX computer is being replaced by the MMIX computer, which is a RISC version. The conversion from MIX to MMIX was a large ongoing project for which Knuth solicited volunteers for help. Software such as GNU MDK[12] exists to provide emulation of the MIX architecture. Knuth considers the use of assembly language necessary for the speed and memory usage of algorithms to be judged.

According to Knuth, MIX was much like any computer then in existence, but nicer.[13] The name 'MIX' is 1009 in Roman numerals and this is given by a formula involving series numbers of several computers of the time: (360 + 650 + 709 + U3 + SS80 + 1107 + 1604 + G2- + B220 + S2000 + 920 + 601 + H800 + PDP-4 + 11)/16 = 1009 or MIX.Template:How The name MMIX is 2009 in Roman numerals and Knuth claims MMIX is even nicer than MIX.

Critical response

Knuth was awarded the 1974 Turing Award "for his major contributions to the analysis of algorithms […], and in particular for his contributions to the 'art of computer programming' through his well-known books in a continuous series by this title."[14] American Scientist has included this work among "100 or so Books that shaped a Century of Science", referring to the twentieth century.[15] Covers of the third edition of Volume 1 quote Bill Gates as saying, "If you think you're a really good programmer… read (Knuth's) Art of Computer Programming… You should definitely send me a résumé if you can read the whole thing."[16] The New York Times referred to it as "the profession's defining treatise".[17]

Volumes

Completed

Planned

English editions

Current editions

These are the current editions in order by volume number:

  • The Art of Computer Programming, Volumes 1-4B Boxed Set. (Reading, Massachusetts: Addison-Wesley, 2023), 3904pp. Template:ISBN
    • Volume 1: Fundamental Algorithms. Third Edition (Reading, Massachusetts: Addison-Wesley, 1997), xx+650pp. Template:ISBN. Errata: [1] (from 2011-01-08), [2] (from 2022, 49th printing). Addenda: [3] (2011).
    • Volume 2: Seminumerical Algorithms. Third Edition (Reading, Massachusetts: Addison-Wesley, 1997), xiv+762pp. Template:ISBN. Errata: [4] (from 2011-01-08), [5] (from 2022, 45th printing). Addenda: [6] (2011).
    • Volume 3: Sorting and Searching. Second Edition (Reading, Massachusetts: Addison-Wesley, 1998), xiv+780pp.+foldout. Template:ISBN. Errata: [7] (from 2011-01-08), [8] (from 2022, 45th printing). Addenda: [9] (2011).
    • Volume 4A: Combinatorial Algorithms, Part 1. First Edition (Upper Saddle River, New Jersey: Addison-Wesley, 2011, 24th printing), xv+883pp. Template:ISBN. Errata: [10] (from 2011), [11] (from 2022, 20th printing).
    • Volume 4B: Combinatorial Algorithms, Part 2. First Edition (Upper Saddle River, New Jersey: Addison-Wesley, 2023, 2nd printing), xviii+714pp. Template:ISBN. Errata: [12] (from 2023, 1st printing).
  • Volume 1, Fascicle 1: MMIX – A RISC Computer for the New Millennium. (Addison-Wesley, 2005-02-14), 144pp. Template:ISBN. Errata: [13] (from 2005, 1st printing) (will be in the fourth edition of volume 1)
  • The MMIX Supplement by Martin Ruckert. (Addison-Wesley), 193pp. Template:ISBN. A conversion of the MIX problems/programs in volumes 1, 2 & 3 to MMIX.
  • Volume 4, Fascicle 7: Constraint Satisfaction. (Addison-Wesley, 2025-02-05), xiv+281pp. Template:ISBN.

Previous editions

Complete volumes

These volumes were superseded by newer editions and are in order by date.

  • Volume 1: Fundamental Algorithms. First edition, 1968, xxi+634pp, Template:ISBN.[23]
  • Volume 2: Seminumerical Algorithms. First edition, 1969, xi+624pp, Template:ISBN.[23]
  • Volume 3: Sorting and Searching. First edition, 1973, xi+723pp+foldout, Template:ISBN. Errata: [14].
  • Volume 1: Fundamental Algorithms. Second edition, 1973, xxi+634pp, Template:ISBN. Errata: [15].
  • Volume 2: Seminumerical Algorithms. Second edition, 1981, xiii+ 688pp, Template:ISBN. Errata: [16].
  • The Art of Computer Programming, Volumes 1-3 Boxed Set. Second Edition (Reading, Massachusetts: Addison-Wesley, 1998), pp. Template:ISBN
  • The Art of Computer Programming, Volumes 1-4A Boxed Set. Third Edition (Reading, Massachusetts: Addison-Wesley, 2011), 3168pp. Template:ISBN

Fascicles

Volume 4, Fascicles 0–4 were revised and published as Volume 4A.

  • Volume 4, Fascicle 0: Introduction to Combinatorial Algorithms and Boolean Functions. (Addison-Wesley Professional, 2008-04-28) vi+240pp, Template:ISBN. Errata: [17] (2011-01-01).
  • Volume 4, Fascicle 1: Bitwise Tricks & Techniques; Binary Decision Diagrams. (Addison-Wesley Professional, 2009-03-27) viii+260pp, Template:ISBN. Errata: [18] (2011-01-01).
  • Volume 4, Fascicle 2: Generating All Tuples and Permutations. (Addison-Wesley, 2005-02-14) v+127pp, Template:ISBN. Errata: [19] (2011-01-01).
  • Volume 4, Fascicle 3: Generating All Combinations and Partitions. (Addison-Wesley, 2005-07-26) vi+150pp, Template:ISBN. Errata: [20] (2011-01-01).
  • Volume 4, Fascicle 4: Generating All Trees; History of Combinatorial Generation. (Addison-Wesley, 2006-02-06) vi+120pp, Template:ISBN. Errata: [21] (2011-01-01).

Volume 4, Fascicles 5–6 were revised and published as Volume 4B.

  • Volume 4, Fascicle 5: Mathematical Preliminaries Redux; Backtracking; Dancing Links. (Addison-Wesley, 2019-11-22) xiii+382pp, Template:ISBN. Errata: [22] (2020-03-27)
  • Volume 4, Fascicle 6: Satisfiability. (Addison-Wesley, 2015-12-08) xiii+310pp, Template:ISBN. Errata: [23] (2020-03-26)

Pre-fascicles

Volume 1

  • Pre-fascicle 1 was revised and published as Volume 1, fascicle 1.

Volume 4

  • Pre-fascicles 0A, 0B, and 0C were revised and published as Volume 4, fascicle 0.
  • Pre-fascicles 1A and 1B were revised and published as Volume 4, fascicle 1.
  • Pre-fascicles 2A and 2B were revised and published as Volume 4, fascicle 2.
  • Pre-fascicles 3A and 3B were revised and published as Volume 4, fascicle 3.
  • Pre-fascicles 4A and 4B were revised and published as Volume 4, fascicle 4.
  • Pre-fascicles 5A, 5B, and 5C were revised and published as Volume 4, fascicle 5.
  • Pre-fascicle 6A was revised and published as Volume 4, fascicle 6.
  • Pre-fascicle 7A was revised and published as Volume 4, fascicle 7.

The remaining pre-fascicles contain draft material that is set to appear in future fascicles and volumes.

See also

References

Notes Template:Notelist

Citations Template:Reflist

Sources Template:Refbegin

  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".

Template:Refend

External links

Template:Commonscat

Template:Donald Knuth navbox

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "citation/CS1".
  6. Script error: No such module "citation/CS1".
  7. Script error: No such module "citation/CS1".
  8. Script error: No such module "citation/CS1".
  9. Script error: No such module "citation/CS1".
  10. Script error: No such module "citation/CS1".
  11. Script error: No such module "citation/CS1".
  12. Script error: No such module "citation/CS1".
  13. Script error: No such module "citation/CS1".
  14. Script error: No such module "citation/CS1".
  15. Script error: No such module "Citation/CS1".
  16. Script error: No such module "citation/CS1".
  17. Script error: No such module "citation/CS1".
  18. Script error: No such module "citation/CS1".
  19. Script error: No such module "citation/CS1".
  20. Script error: No such module "citation/CS1".
  21. Script error: No such module "citation/CS1".
  22. a b Script error: No such module "citation/CS1".
  23. a b Script error: No such module "Citation/CS1".


Cite error: <ref> tags exist for a group named "lower-alpha", but no corresponding <references group="lower-alpha"/> tag was found