HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Also available in other formats.
Register your product to gain access to bonus material or receive a coupon.
The MMIX Supplement: Supplement to The Art of Computer ProgrammingVolumes 1, 2, 3 by Donald E. Knuth
“I encourage serious programmers everywhere to sharpen their skills by devouring this book.”
–Donald E. Knuth
In the first edition of Volume 1 of The Art of Computer Programming, Donald E. Knuth introduced the MIX computer and its machine language: a teaching tool that powerfully illuminated the inner workings of the algorithms he documents. Later, with the publication of his Fascicle 1, Knuth introduced MMIX: a modern, 64-bit RISC replacement to the now-obsolete MIX. Now, with Knuth’s guidance and approval, Martin Ruckert has rewritten all MIX example programs from Knuth’s Volumes 1-3 for MMIX, thus completing this MMIX update to the original classic.
Building on contributions from the international MMIXmasters volunteer group, Ruckert fully addresses MMIX basic concepts, information structures, random numbers, arithmetic, sorting, and searching. In the preparation of this supplement, about 15,000 lines of MMIX code were written and checked for correctness; over a thousand test cases were written and executed to ensure the code is of the highest possible quality.
The MMIX Supplement should be read side by side with The Art of Computer Programming, Volumes 1-3, and Knuth’s Fascicle 1, which introduces the MMIX computer, its design, and its machine language. Throughout, this supplement contains convenient page references to corresponding coverage in the original volumes. To further simplify the transition to MMIX, Ruckert stayed as close as possible to the original–preserving programming style, analysis techniques, and even wording, while highlighting differences where appropriate. The resulting text will serve as a bridge to the future, helping readers apply Knuth’s insights in modern environments, until his revised, “ultimate” edition of The Art of Computer Programming is available.
From Donald E. Knuth’s Foreword:
“I am thrilled to see the present book by Martin Ruckert: It is jam-packed with goodies from which an extraordinary amount can be learned. Martin has not merely transcribed my early programs for MIX and recast them in a modern idiom. He has penetrated to their essence and rendered them anew with elegance and good taste. His carefully checked code represents a significant contribution to the art of pedagogy as well as to the art of programming.”
Dr. Martin Ruckert maintains the MMIX home page at mmix.cs.hm.edu. He is professor of mathematics and computer science at Munich University of Applied Sciences in Munich, Germany.
Foreword iii
Preface v
Style Guide viii
Programming Techniques xii
Chapter 1: Basic Concepts 1
1.3.3. Applications to Permutations 1
1.4.4. Input and Output 8
Chapter 2: Information Structures 15
2.1. Introduction 15
2.2.2. Sequential Allocation 17
2.2.3. Linked Allocation 18
2.2.4. Circular Lists 25
2.2.5. Doubly Linked Lists 27
2.2.6. Arrays and Orthogonal Lists 36
2.3.1. Traversing Binary Trees 37
2.3.2. Binary Tree Representation of Trees 39
2.3.3. Other Representations of Trees 43
2.3.5. Lists and Garbage Collection 44
2.5. Dynamic Storage Allocation 45
Chapter 3: Random Numbers 48
3.2.1.1. Choice of modulus 48
3.2.1.3. Potency 49
3.2.2. Other Methods 50
3.4.1. Numerical Distributions 51
3.6. Summary 52
Chapter 4: Arithmetic 53
4.1. Positional Number Systems 53
4.2.1. Single-Precision Calculations 53
4.2.2. Accuracy of Floating Point Arithmetic 58
4.2.3. Double-Precision Calculations 58
4.3.1. The Classical Algorithms 62
4.4. Radix Conversion 68
4.5.2. The Greatest Common Divisor 70
4.5.3. Analysis of Euclid’s Algorithm 71
4.5.4. Factoring into Primes 72
4.6.3. Evaluation of Powers 72
4.6.4. Evaluation of Polynomials 73
Chapter 5: Sorting 74
5.2. Internal Sorting 74
5.2.1. Sorting by Insertion 76
5.2.2. Sorting by Exchanging 81
5.2.3. Sorting by Selection 87
5.2.4. Sorting by Merging 89
5.2.5. Sorting by Distribution 93
5.3.1. Minimum-Comparison Sorting 94
5.5. Summary, History, and Bibliography 95
Chapter 6: Searching 97
6.1. Sequential Searching 97
6.2.1. Searching an Ordered Table 99
6.2.2. Binary Tree Searching 102
6.2.3. Balanced Trees 103
6.3. Digital Searching 106
6.4. Hashing 108
Answers to Exercises 117
1.3.2. The MMIX Assembly Language 117
1.3.3. Applications to Permutations 120
1.4.4. Input and Output 120
2.1. Introduction 122
2.2.2. Sequential Allocation 123
2.2.3. Linked Allocation 124
2.2.4. Circular Lists 128
2.2.5. Doubly Linked Lists 130
2.2.6. Arrays and Orthogonal Lists 132
2.3.1. Traversing Binary Trees 134
2.3.2. Binary Tree Representation of Trees 136
2.3.5. Lists and Garbage Collection 139
2.5. Dynamic Storage Allocation 140
3.2.1.1. Choice of modulus 147
3.2.1.3. Potency 148
3.2.2. Other Methods 148
3.4.1. Numerical Distributions 149
3.6. Summary 150
4.1. Positional Number Systems 150
4.2.1. Single-Precision Calculations 151
4.2.2. Accuracy of Floating Point Arithmetic 152
4.2.3. Double-Precision Calculations 153
4.3.1. The Classical Algorithms 156
4.4. Radix Conversion 158
4.5.2. The Greatest Common Divisor 160
4.5.3. Analysis of Euclid’s Algorithm 160
4.6.3. Evaluation of Powers 161
4.6.4. Evaluation of Polynomials 161
5. Sorting 162
5.2. Internal Sorting 162
5.2.1. Sorting by Insertion 165
5.2.2. Sorting by Exchanging 169
5.2.3. Sorting by Selection 174
5.2.4. Sorting by Merging 175
5.2.5. Sorting by Distribution 179
5.3.1. Minimum-Comparison Sorting 180
5.5. Summary, History, and Bibliography 183
6.1. Sequential Searching 183
6.2.1. Searching an Ordered Table 184
6.2.2. Binary Tree Searching 185
6.2.3. Balanced Trees 185
6.3. Digital Searching 185
6.4. Hashing 186
Acknowledgments 188
Index 189