You are on page 1of 154
SOLUTIONS MANUAL JAMES GRIMMELMANN ELEMENTS OF THE THEORY OF COMPUTATION SECOND EDITION HARRY R. LEWIS CHRISTOS H. PAPADIMITRIOU Acquisitions Editor: Petra Recter Supplement Editor: Jake Warde Special Projects Manager: Barbara A. Murray Production Editor: Barbara A. Till Supplement Cover Manager: Paul Gourhan Supplement Cover Designer: Liz Nemeth Manufacturing Buyer: Pat Brown © 1999 by Prentice Hall Upper Saddle River, NJ 07458 Alll rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher Printed in the United States of America 9876543 ISBN 0-13-779471-1 Prentice-Hall International (UK) Limited, London Prentice-Hall of Australia Pty. Limited, Sydney Prentice-Hall Canada, Inc., Toronto Prentice-Hall Hispanoamericana, S.A., Mexico Prentice-Hall of India Private Limited, New Delhi --Hall of Japan, Inc., Tokyo Editora Prentice-Hall do Brazil, Ltda., Rio de Janeiro Preface and Acknowledgements ‘This manual contains, with a few exceptions, solutions to every problem posed in Elements of the Theory of Computation. Certain problems which are intractable as stated are omitted, although where a correct interpretation was available for a clearly “wrong” problem, a solution to the problem-as-intended is presented instead. ‘The level of rigor of solutions varies: the general approach is to give a precise formal construction, along with the intuition of why the construction works and a brief synopsis of how a rigorous proof of correctness could be given. For a few problems, these rigorous proofs are spelled out in their full and painful detail, so that the reader will have a model for other, similar proofs. Occasionally, the formal consrtuctions are also given in outline form, when it is clear that filling in the details requires no additional insight. Where possible, I have used the Greek letters o and r to stand for individual symbols; in most other respects, the notation is consistent with the notation in Elements. Neither this solution manual nor Elements itself, of course, would exist without Harry Lewis and Chris- tos Papadimitriou. Without Professor Lewis's help on more occasions than I can remember, this manual would never have seen the light of day. His wise advice and unceasing support have been invaluable, both professionally and personally. Unfortunately, my contact with Professor Papadimitriou has been limited to exchange of email, but his assistance has saved me from at least one near-disaster. Every book is the product of a much larger team effort than its title page would indicate, and this “book,” such as itis, is no exception. First, and foremost, I must thank the teaching staff of Computer Science 121, past, present, and future. The ideas behind the solutions to many of these problems, a million-and-one good ways of explaining ideas, and a great deal more, are entirely their achievement. Special mention must go to Robert Haas for several very effective ways of laying out equations, and to Russ Cox for introducing me to MetaPost. Also from 121, I recognize with gratitude the contributions of Yong-Yeow Yeoh, Lillian Lee, Allyn Dimock, Ben Wildasin, Adam Ginsburg, Robyn Yilmaz, Omri Traub, Becky Weiss, Jessica Hammer, Sam Riesenfeld, Kostas Magoutis, Jaime Chambron, Grace Kwak, Eric Feigin, and Luke Hunsberger: my ‘eachers, my colleagues, my friends. I would also like to thank those at Prentice Hall who edited this manual; unfortunately, their number precludes individual mention. ‘During the summer in which I prepared this volume, there were a number of people who rendered more specific help in the writing process, I am indebted to Peg Schafer and the EECS computer support staff for their many helpful acts, to everyone who put up with my endless ranting about one problem or another, and to my roommates and other friends in Cambridge who kept me sane. Of course, it would all have been impossible without my parents, biological and step. That I have been able to write this manual is their accomplishment, much more than it is mine. Tt would be customary, therefore, to dedicate this volume to them. However, I have a sister, who has already dedicated several books to me, and I am finally in a position to return the compliment. Therefore, this manual is for Rachel, with all my love.

You might also like