Synopses & Reviews
The Art of Computer Programming, Volume 4A: Combinatorial Algorithms, Part 1
Knuth’s multivolume analysis of algorithms is widely recognized as the definitive description of classical computer science. The first three volumes of this work have long comprised a unique and invaluable resource in programming theory and practice. Scientists have marveled at the beauty and elegance of Knuth’s analysis, while practicing programmers have successfully applied his “cookbook” solutions to their daytoday problems.
The level of these first three volumes has remained so high, and they have displayed so wide and deep a familiarity with the art of computer programming, that a sufficient “review” of future volumes could almost be: “Knuth, Volume n has been published.”
—Data Processing Digest
Knuth, Volume n has been published, where n = 4A.
In this longawaited new volume, the old master turns his attention to some of his favorite topics in broadword computation and combinatorial generation (exhaustively listing fundamental combinatorial objects, such as permutations, partitions, and trees), as well as his more recent interests, such as binary decision diagrams.
The hallmark qualities that distinguish his previous volumes are manifest here anew: detailed coverage of the basics, illustrated with wellchosen examples; occasional forays into more esoteric topics and problems at the frontiers of research; impeccable writing peppered with occasional bits of humor; extensive collections of exercises, all with solutions or helpful hints; a careful attention to history; implementations of many of the algorithms in his classic stepbystep form.
There is an amazing amount of information on each page. Knuth has obviously thought long and hard about which topics and results are most central and important, and then, what are the most intuitive and succinct ways of presenting that material. Since the areas that he covers in this volume have exploded since he first envisioned writing about them, it is wonderful how he has managed to provide such thorough treatment in so few pages.
—Frank Ruskey, Department of Computer Science, University of Victoria
The book is Volume 4A, because Volume 4 has itself become a multivolume undertaking. Combinatorial searching is a rich and important topic, and Knuth has too much to say about it that is new, interesting, and useful to fit into a single volume, or two, or maybe even three. This book alone includes approximately 1500 exercises, with answers for selfstudy, plus hundreds of useful facts that cannot be found in any other publication. Volume 4A surely belongs beside the first three volumes of this classic work in every serious programmer’s library.
Finally, after a wait of more than thirtyfive years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1  4A in one elegant case, and offers the purchaser a $50 discount off the price of buying the four volumes individually.
The Art of Computer Programming, Volumes 14A Boxed Set, 3/e
Synopsis
The Art of Computer Programming, Volume 4A: Combinatorial Algorithms, Part 1
Knuth's multivolume analysis of algorithms is widely recognized as the definitive description of classical computer science. The first three volumes of this work have long comprised a unique and invaluable resource in programming theory and practice. Scientists have marveled at the beauty and elegance of Knuth's analysis, while practicing programmers have successfully applied his cookbook solutions to their daytoday problems.
The level of these first three volumes has remained so high, and they have displayed so wide and deep a familiarity with the art of computer programming, that a sufficient review of future volumes could almost be: Knuth, Volume n has been published.

Data Processing Digest
Knuth, Volume n has been published, where n = 4A.
In this longawaited new volume, the old master turns his attention to some of his favorite topics in broadword computation and combinatorial generation (exhaustively listing fundamental combinatorial objects, such as permutations, partitions, and trees), as well as his more recent interests, such as binary decision diagrams.
The hallmark qualities that distinguish his previous volumes are manifest here anew: detailed coverage of the basics, illustrated with wellchosen examples; occasional forays into more esoteric topics and problems at the frontiers of research; impeccable writing peppered with occasional bits of humor; extensive collections of exercises, all with solutions or helpful hints; a careful attention to history; implementations of many of the algorithms in his classic stepbystep form.
There is an amazing amount of information on each page. Knuth has obviously thought long and hard about which topics and results are most central and important, and then, what are the most intuitive and succinct ways of presenting that material. Since the areas that he covers in this volume have exploded since he first envisioned writing about them, it is wonderful how he has managed to provide such thorough treatment in so few pages.
Frank Ruskey, Department of Computer Science, University of Victoria
The book is Volume 4A, because Volume 4 has itself become a multivolume undertaking. Combinatorial searching is a rich and important topic, and Knuth has too much to say about it that is new, interesting, and useful to fit into a single volume, or two, or maybe even three. This book alone includes approximately 1500 exercises, with answers for selfstudy, plus hundreds of useful facts that cannot be found in any other publication. Volume 4A surely belongs beside the first three volumes of this classic work in every serious programmer's library.
Finally, after a wait of more than thirtyfive years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1  4A in one elegant case, and offers the purchaser a $50 discount off the price of buying the four volumes individually.
Ebook (PDF version) produced by Mathematical Sciences Publishers (MSP), http: //msp.org
The Art of Computer Programming, Volumes 14A Boxed Set, 3/e
ISBN: 0321751043
Synopsis
Finally, after a wait of more than thirtyfive years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1  4A in one elegant case, and offers the purchaser a $50 discount off the price of buying the four volumes individually.
The Art of Computer Programming, Volumes 14A Boxed Set, 3/e
Synopsis
This boxed set consists of the following four volumes:
0201896834 / 9780201896831 Art of Computer Programming, Volume 1: Fundamental Algorithms
0201896842 / 9780201896848 Art of Computer Programming, Volume 2: Seminumerical Algorithms
0201896850 / 9780201896855 Art of Computer Programming, Volume 3: Sorting and Searching
0201038048 / 9780201038040 Art of Computer Programming, Volume 4A: Combinatorial Algorithms
Synopsis
The bible of all fundamental algorithms and the work that taught many of today’s software developers most of what they know about computer programming.
—Byte, September 1995
Countless readers have spoken about the profound personal influence of Knuth’s work. Scientists have marveled at the beauty and elegance of his analysis, while ordinary programmers have successfully applied his “cookbook” solutions to their daytoday problems. All have admired Knuth for the breadth, clarity, accuracy, and good humor found in his books.
I can’t begin to tell you how many pleasurable hours of study and recreation they have afforded me! I have pored over them in cars, restaurants, at work, at home… and even at a Little League game when my son wasn’t in the lineup.
—Charles Long
Primarily written as a reference, some people have nevertheless found it possible and interesting to read each volume from beginning to end. A programmer in China even compared the experience to reading a poem.
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.
—Bill Gates
Whatever your background, if you need to do any serious computer programming, you will find your own good reason to make each volume in this series a readily accessible part of your scholarly or professional library.
It’s always a pleasure when a problem is hard enough that you have to get the Knuths off the shelf. I find that merely opening one has a very useful terrorizing effect on computers.
—Jonathan Laventhol
In describing the new fourth volume, one reviewer listed the qualities that distinguish all of Knuth’s work.
[In sum:] detailed coverage of the basics, illustrated with wellchosen examples; occasional forays into more esoteric topics and problems at the frontiers of research; impeccable writing peppered with occasional bits of humor; extensive collections of exercises, all with solutions or helpful hints; a careful attention to history; implementations of many of the algorithms in his classic stepbystep form.
—Frank Ruskey
These four books comprise what easily could be the most important set of information on any serious programmer’s bookshelf.
About the Author
Donald E. Knuth is known throughout the world for his pioneering work on algorithms and programming techniques, for his invention of the TEX and METAFONT systems for computer typesetting, and for his prolific and influential writing (26 books, 161 papers). Professor Emeritus of The Art of Computer Programming at Stanford University, he currently devotes full time to the completion of his seminal multivolume series on classical computer science, begun in 1962 when he was a graduate student at California Institute of Technology. Professor Knuth is the recipient of numerous awards and honors, including the ACM Turing Award, the Medal of Science presented by President Carter, the AMS Steele Prize for expository writing, and, in November, 1996, the prestigious Kyoto Prize for advanced technology. He lives on the Stanford campus with his wife, Jill.
Table of Contents
Preface Notes on the Exercises
Chapter 7: Combinatorial Searching 1
7.1: Zeros and Ones 47
7.2: Generating All Possibilities 281
Answers to Exercises 514
Appendix A: Tables of Numerical Quantities 818
Appendix B: Index to Notations 822
Appendix C: Index to Algorithms and Theorems 828
Appendix D: Index to Combinatorial Problems 830
Index and Glossary 834