computer science
A N O V E RV I E W
This page intentionally left blank
computer science
A N O V E R V I E W
11th Edition
J. Glenn Brookshear
with contributions from
David T. Smith
Indiana University of Pennsylvania
Dennis Brylow
Marquette University
Addison-Wesley
Boston Columbus Indianapolis New York San Francisco Upper Saddle River
Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montréal Toronto
Delhi Mexico City São Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
Editorial Director: Marcia Horton
Editor-in-Chief: Michael Hirsch
Editorial Assistant: Stephanie Sellinger
Vice President of Marketing: Patrice Jones
Marketing Manager: Yezan Alayan
Marketing Coordinator: Kathryn Ferranti
Vice President, Production: Vince O’Brien
Managing Editor: Jeff Holcomb
Production Project Manager: Kayla
Smith-Tarbox
Senior Operations Supervisor: Lisa McDowell
Art Directors: Jayne Conte and Kristine
Carney
Cover Designer: Rachael Cronin
Cover Image: “Slot Canyon”
RF Media Editor: Dan Sandin and Wanda
© gettyimages® Inc.
Rockwell
Project Management: GEX Publishing Services
Composition and Illustration: GEX Publishing
Services
Printer/Binder: Edwards Brothers
Cover Printer: Lehigh-Phoenix
Color/Hagerstown
Credits
Figure 0.3: “An abacus ”. © Wayne Chandler. Figure 0.4: “The Mark I computer.” Courtesy of
IBM corporate archives. Unauthorized use is not permitted. Figure 10.1: “A photograph of a viral
world produced by using 3D graphics (from Toy Story by Walt Disney/Pixar Animation Studios) ©
Disney/Pixar. Figure 10.6: “A scene from Shrek 2 by Dreamworks SKG. © Dreamworks/
Picture Desk Inc./Kobal collection. Figure 11.19: “Results of using a neural network to classify
pixels in an image.” Inspired by www.actapress.com. Chapter 11, Robots Making History
feature: a. “A soccer robot kicks a ball during the RoboCup German Open 2010 on April 15, 2010
in Magdeburg, eastern Germany.” © Jens Schlueter/AFP/ Getty Images/ Newscom. b. “Tartan
Racing’s “Boss—winner of the Urban Challenge, a contest sponsored by DARPA to have vehicles
drive themselves an urban environment.” © DARPA. c. “One of NASA’s rovers—a robot geologist
exploring the surface of Mars.” Courtesy of NASA/JPL-Caltech.
Copyright © 2012, 2009, 2007, 2005, 2003 Pearson Education, Inc., publishing as Addison-
Wesley. All rights reserved. Manufactured in the United States of America. This publication is
protected by Copyright, and permission should be obtained from the publisher prior to any
prohibited reproduction, storage in a retrieval system, or transmission in any form or by any
means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s)
to use material from this work, please submit a written request to Pearson Education, Inc.,
Permissions Department, 501 Boylston Street, Suite 900, Boston, Massachusetts 02116.
Many of the designations by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in this book, and the publisher was
aware of a trademark claim, the designations have been printed in initial caps or all caps.
Library of Congress Catologing-in-Publication Data available upon request.
10 9 8 7 6 5 4 3 2 1—EB—14 13 12 11 10
ISBN 10: 0-13-256903-5
ISBN 13: 978-0-13-256903-3
preface
This book presents an introductory survey of computer science. It explores the
breadth of the subject while including enough depth to convey an honest appre-
ciation for the topics involved.
Audience
I wrote this text for students of computer science as well as students from
other disciplines. As for computer science students, most begin their studies
with the illusion that computer science is programming, Web browsing, and
Internet file sharing since that is essentially all they have seen. Yet computer
science is much more than this. In turn, beginning computer science stu-
dents need exposure to the breadth of the subject in which they are planning
to major. Providing this exposure is the theme of this book. It gives students
an overview of computer science—a foundation from which they can appreci-
ate the relevance and interrelationships of future courses in the field. This
survey approach is, in fact, the model used for introductory courses in the
natural sciences.
This broad background is also what students from other disciplines need if
they are to relate to the technical society in which they live. A computer science
course for this audience should provide a practical, realistic understanding of the
entire field rather than merely an introduction to using the Internet or training
in the use of some popular software packages. There is, of course, a proper place
for training, but this text is about educating.
Thus, while writing this text, maintaining accessibility for nontechnical stu-
dents was a major goal. The result is that previous editions have been used suc-
cessfully in courses for students over a wide range of disciplines and educational
levels, ranging from high school to graduate courses. This eleventh edition is
designed to continue that tradition.
New in the Eleventh Edition
The underlying theme during the development of this eleventh edition was to
update the text to include handheld mobile devices, in particular smartphones.
Thus, you will find that the text has been modified, and at times expanded, to
v
vi
Preface
present the relationship between the subject matter being discussed and smart-
phone technology. Specific topics include:
• Smartphone hardware
• The distinction between 3G and 4G networks
• Smartphone operating systems
• Smartphone software development
• The human/smartphone interface
These additions are most noticeable in Chapters 3 (Operating Systems) and
4 (Networking) but is also observable in Chapters 6 (Programming Languages),
and 7 (Software Engineering).
Other prominent changes to this edition include updates to the following
topics:
• Software ownership and liability: The material in Chapter 7 (Software
Engineering) pertaining to this topic has been rewritten and updated.
• Training artificial neural networks: This material, in Chapter 11 (Artificial
Intelligence), has been modernized.
Finally, you will find that the material throughout the text has been updated
to reflect the state of today’s technology. This is most prevalent in Chapter 0
(Introduction), Chapter 1 (Data Storage), and Chapter 2 (Data Manipulation).
Organization
This text follows a bottom-up arrangement of subjects that progresses from the
concrete to the abstract—an order that results in a sound pedagogical presentation
in which each topic leads to the next. It begins with the fundamentals of informa-
tion encoding, data storage, and computer architecture (Chapters 1 and 2); pro-
gresses to the study of operating systems (Chapter 3) and computer networks
(Chapter 4); investigates the topics of algorithms, programming languages, and
software development (Chapters 5 through 7); explores techniques for enhancing
the accessibility of information (Chapters 8 and 9); considers some major applica-
tions of computer technology via graphics (Chapter 10) and artificial intelligence
(Chapter 11); and closes with an introduction to the abstract theory of computa-
tion (Chapter 12).
Although the text follows this natural progression, the individual chapters
and sections are surprisingly independent and can usually be read as isolated
units or rearranged to form alternative sequences of study. Indeed, the book is
often used as a text for courses that cover the material in a variety of orders. One
of these alternatives begins with material from Chapters 5 and 6 (Algorithms and
Programming Languages) and returns to the earlier chapters as desired. In con-
trast, I know of one course that starts with the material on computability from
Chapter 12. In still other cases the text has been used in “senior capstone”
courses where it serves as merely a backbone from which to branch into projects
in different areas. Courses for less technically oriented audiences may want to
concentrate on Chapters 4 (Networking and the Internet), 9 (Database Systems),
10 (Computer Graphics), and 11 (Artificial Intelligence).
On the opening page of each chapter, I have used asterisks to mark some sec-
tions as optional. These are sections that cover topics of more specific interest or
To Instructors
vii
perhaps explore traditional topics in more depth. My intention is merely to pro-
vide suggestions for alternative paths though the text. There are, of course, other
shortcuts. In particular, if you are looking for a quick read, I suggest the follow-
ing sequence:
Section
1.1–1.4
2.1–2.3
3.1–3.3
4.1–4.3
5.1–5.4
6.1–6.4
7.1–7.2
8.1–8.3
9.1–9.2
10.1–10.2
11.1–11.3
12.1–12.2
Topic
Basics of data encoding and storage
Machine architecture and machine language
Operating systems
Networking and the Internet
Algorithms and algorithm design
Programming languages
Software engineering
Data abstractions
Database systems
Computer graphics
Artificial intelligence
Theory of computation
There are several themes woven throughout the text. One is that computer
science is dynamic. The text repeatedly presents topics in a historical perspec-
tive, discusses the current state of affairs, and indicates directions of research.
Another theme is the role of abstraction and the way in which abstract tools are
used to control complexity. This theme is introduced in Chapter 0 and then
echoed in the context of operating system architecture, networking, algorithm
development, programming language design, software engineering, data organi-
zation, and computer graphics.
To Instructors
There is more material in this text than can normally be covered in a single
semester so do not hesitate to skip topics that do not fit your course objectives or
to rearrange the order as you see fit. You will find that, although the text follows
a plot, the topics are covered in a largely independent manner that allows you to
pick and choose as you desire. The book is designed to be used as a course
resource—not as a course definition. I suggest encouraging students to read the
material not explicitly included in your course. I think we underrate students if
we assume that we have to explain everything in class. We should be helping
them learn to learn on their own.
I feel obliged to say a few words about the bottom-up, concrete-to-abstract
organization of the text. I think as academics we too often assume that students
will appreciate our perspective of a subject—often one that we have developed
over many years of working in a field. As teachers I think we do better by pre-
senting material from the student’s perspective. This is why the text starts with
data representation/storage, machine architecture, operating systems, and net-
working. These are topics to which students readily relate—they have most
likely heard terms such as JPEG and MP3; they have probably recorded data on
CDs and DVDs; they have purchased computer components; they have inter-
acted with an operating system; and they have used the Internet. By starting the
course with these topics, students discover answers to many of the “why” ques-
tions they have been carrying for years and learn to view the course as practical