Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

Invitation to Computer Science 8th

Edition G. Michael Schneider


Visit to download the full and correct content document:
https://ebookmass.com/product/invitation-to-computer-science-8th-edition-g-michael-
schneider/
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
8th Edition

Invitation
to Computer
Science

G. Michael Schneider
Macalester College

Judith L. Gersting
Indiana University-Purdue University
at Indianapolis

Australia • Brazil • Mexico • Singapore • United Kingdom • United States

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions,
some third party content may be suppressed. Editorial review has deemed that any suppressed
content does not materially affect the overall learning experience. The publisher reserves the right
to remove content from this title at any time if subsequent rights restrictions require it. For
valuable information on pricing, previous editions, changes to current editions, and alternate
formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for
materials in your areas of interest.

Important Notice: Media content referenced within the product description or the product
text may not be available in the eBook version.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Invitation to Computer ­Science, © 2019, 2016 Cengage Learning, Inc.
8th Edition
Unless otherwise noted, all content is © Cengage.
G. Michael Schneider & Judith L. Gersting
ALL RIGHTS RESERVED. No part of this work covered by the copy-
right herein may be reproduced or distributed in any form or by
SVP, GM Skills & Global Product Management:
any means, except as permitted by U.S. copyright law, without the
Jonathan Lau
prior written permission of the copyright owner.
Product Director: Lauren Murphy

Product Team Manager: Kristin McNary


For product information and technology assistance, contact us at
Product Manager: Kate Mason Cengage Customer & Sales Support, 1-800-354-9706

Executive Director, Development: Marah Bellegarde


For permission to use material from this text or product, submit
Senior Content Development Manager: all requests online at www.cengage.com/permissions.
Leigh Hefferon Further permissions questions can be e-mailed to
permissionrequest@cengage.com
Developmental Editor: Deb Kaufmann

Senior Content Developer, Media: Michelle


­Ruelos Cannistraci
Library of Congress Control Number: 2017955994
Project Manager: Ann Loch
Student Edition ISBN: 978-1-3375-6191-4
Product Assistant: Jake Toth
Loose Leaf ISBN: 978-1-337-68593-1
Vice President, Marketing Services: Jennifer Ann
Baker Cengage
Marketing Manager: Stephanie Albracht 20 Channel Center Street
Boston, MA 02210
Senior Content Project Manager: Jennifer
USA
Feltri-George

Content Digitization Project Manager: Laura Cengage is a leading provider of customized learning solutions with
Ruschman employees residing in nearly 40 different countries and sales in more
than 125 countries around the world. Find your local representative
Senior Digital Project Manager: Noah Vincelette at www.cengage.com.
Senior Art Director: Diana Graham
Cengage products are represented in Canada by Nelson Education, Ltd.
Cover Designer: Angela Sheehan

Cover image(s): sumkinn/Shutterstock.com; To learn more about Cengage platforms and services, visit
­sumkinn/Shutterstock.com; Studiojumpee/ www.cengage.com.
Shutterstock.com
To register or access your online learning solution or purchase materials
Production Service/Composition: SPi Global for your course, visit www.cengagebrain.com.

Notice to the Reader

Publisher does not warrant or guarantee any of the products described herein or perform any independent analysis in c­ onnection
with any of the product information contained herein. Publisher does not assume, and expressly disclaims, any obligation to obtain
and include information other than that provided to it by the manufacturer. The reader is expressly warned to consider and adopt
all safety precautions that might be indicated by the activities described herein and to avoid all potential hazards. By f­ ollowing
the instructions contained herein, the reader willingly assumes all risks in connection with such instructions. The p ­ ublisher makes
no representations or warranties of any kind, including but not limited to, the warranties of fitness for particular purpose or
­merchantability, nor are any such representations implied with respect to the material set forth herein, and the publisher takes no
responsibility with respect to such material. The publisher shall not be liable for any special, consequential, or exemplary damages
resulting, in whole or part, from the readers’ use of, or reliance upon, this material.

Printed in the United States of America


Print Number: 01 Print Year: 2018

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
To my wife, Ruthann, our children, Benjamin, Rebecca,
and Trevor, grandson, Liam, and granddaughter, Sena.

G. M. S.

To my husband, John, and to: Adam and Francine; Jason,


Cathryn, Sammie, and Johnny.

J. L. G.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Level 6

Chap
ter Social
s
17 Issue
Level 5
Chap
te ions
14, 15rs 13, Applicat
, 16

Level 4
Chap
ters are
9 S oftw
11, 1 , 10, Th e d
2 Worl
Level 3

Chap e
ters lM achin
6, 7,
8 V irtua
The
Level 2

d
Chap Worl
ters ware
4, 5 Hard
The
Level 1
s
u n d ation
Fo
Chap
ters o r i t hmic Science
2, 3 Alg ter
The f Compu
o

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Brief Contents

Chapter 1 
An Introduction to Computer
Science   2

LEVEL 1 The Algorithmic Foundations


of Computer Science   42
Chapter 2 
Algorithm Discovery
and Design   44
Chapter 3 
The Efficiency of
Algorithms   92

LEVEL 2 The Hardware World   150


Chapter 4 
The Building Blocks: Binary
Numbers, Boolean Logic,
and Gates   152
Chapter 5 
Computer Systems
Organization   222

LEVEL 3 The Virtual Machine   278


Chapter 6 An Introduction to System
Software and Virtual
Machines   280
Chapter 7 Computer Networks and Cloud
Computing   336
Chapter 8 Information Security   394

LEVEL 4 The Software World   432


Chapter 9 
Introduction to High-Level
Language Programming   434
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202 v
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
vi Brief Contents

Chapter 10 The Tower of Babel:


Programming
Languages   480
Chapter 11 Compilers and Language
Translation   542
Chapter 12 Models of
Computation   588

LEVEL 5 Applications   636
Chapter 13 Simulation and
Modeling   638
Chapter 14 Ecommerce, Databases,
and Data Science   670
Chapter 15 Artificial Intelligence   712
Chapter 16 Computer Graphics and
Entertainment: Movies,
Games, and Virtual
Communities   758

LEVEL 6 Social Issues in Computing   790


Chapter 17 Making Decisions about
Computers, Information,
and Society   792

Answers to Practice Problems   833


Index   877

Online Chapters
This text includes five language-specific online-only downloadable
chapters on Ada, C++, C#, Java, and Python, available on the com-
panion site for this text (www.cengage.com) and in MindTap.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents

Preface to the Eighth Edition    xix

Chapter 1 An Introduction to Computer Science   2


Introduction   2
1.1  
Special Interest Box: In the Beginning . . .    5
1.2  The Definition of Computer Science   6
Special Interest Box: Abu Ja’far Muhammad ibn
Musa Al-Khwarizmi (AD 780–850?)    10
1.3  Algorithms   12
1.3.1  The Formal Definition of an Algorithm    12
1.3.2  The Importance of Algorithmic
Problem Solving   17
Practice Problems   18
1.4  A Brief History of Computing    18
1.4.1  The Early Period: Up to 1940    18
Special Interest Box: The Original “Technophobia”    22
Special Interest Box: Charles Babbage (1791–1871)
Ada Augusta Byron, Countess of Lovelace (1815–1852)    24
1.4.2  The Birth of Computers: 1940–1950    24
Special Interest Box: John Von Neumann (1903–1957)    28
1.4.3  The Modern Era: 1950 to the Present    28
Special Interest Box: And the Verdict Is . . .    29
Special Interest Box: The World’s First Microcomputer    31
1.5  Organization of the Text   34
Laboratory Experience 1   38
EXERCISES   39
CHALLENGE WORK   41

LEVEL 1 The Algorithmic Foundations


of Computer Science   42
Chapter 2 Algorithm Discovery and Design    44
2.1  
Introduction   44
2.2  
Representing Algorithms   44
2.2.1  Pseudocode   44
2.2.2  Sequential Operations   48
2.2.3  Conditional and Iterative Operations    50

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202 vii
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
viii Contents

Practice Problems   51
Special Interest Box: From Little Primitives Mighty
Algorithms Grow   60
2.3  Examples of Algorithmic Problem Solving    60
2.3.1   Example 1: Go Forth and Multiply    60
Practice Problems   61
Practice Problems   64
2.3.2  Example 2: Looking, Looking,
Looking   65
Laboratory Experience 2   70
2.3.3   Example 3: Big, Bigger, Biggest    70
Practice Problems   76
Laboratory Experience 3   76
2.3.4   Example 4: Meeting Your Match    77
Special Interest Box: Hidden Figures   84
2.4  Conclusion   84
Practice Problems   85
EXERCISES   86
CHALLENGE WORK   89

Chapter 3 The Efficiency of Algorithms    92


Introduction   92
3.1  
Attributes of Algorithms   92
3.2  
Practice Problems   97
3.3  Measuring Efficiency   97
3.3.1  Sequential Search   97
3.3.2  Order of Magnitude—Order n   100
Special Interest Box: Flipping Pancakes   102
3.3.3  Selection Sort   102
Practice Problem   103
Practice Problems   109
3.3.4  Order of Magnitude—Order n2   109
Special Interest Box: The Tortoise and the Hare    113
Laboratory Experience 4   114
Practice Problem   115
3.4  Analysis of Algorithms   115
3.4.1  Data Cleanup Algorithms   115
3.4.2  Binary Search   123
Practice Problems   123
Practice Problems   129
Laboratory Experience 5   130
3.4.3  Pattern Matching   130
3.4.4  Summary   131
Practice Problem   132
3.5  When Things Get Out of Hand    132
Practice Problems   137
3.6  Summary of Level 1    137
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents ix

Laboratory Experience 6   138


EXERCISES   139
CHALLENGE WORK   149

LEVEL 2 The Hardware World   150


Chapter 4 The Building Blocks: Binary Numbers, Boolean
Logic, and Gates   152
Introduction   152
4.1  
The Binary Numbering System    153
4.2  
B
 inary
Representation of Numeric and
4.2.1  
Textual Information   153
Special Interest Box: A Not So Basic Base    158
Practice Problems   166
4.2.2   Binary Representation of Sound
and Images   167
Practice Problems   175
4.2.3  The Reliability of Binary
Representation   176
4.2.4   Binary Storage Devices   177
Special Interest Box: Moore’s Law and the Limits
of Chip Design   182
4.3  Boolean Logic and Gates   183
4.3.1   Boolean Logic   183
Practice Problems   187
4.3.2   Gates   188
Special Interest Box: George Boole (1815–1864)    192
4.4  Building Computer Circuits   193
4.4.1   Introduction   193
4.4.2   A Circuit Construction Algorithm    195
Practice Problems   199
4.4.3  Examples of Circuit Design and
­Construction   200
Laboratory Experience 7   200
Laboratory Experience 8   208
Practice Problems   209
Special Interest Box: Dr. William Shockley
(1910–1989)   209
4.5  Control Circuits   211
4.6  Conclusion   215
EXERCISES   217
CHALLENGE WORK   220

Chapter 5 Computer Systems Organization   222


Introduction   222
5.1  
The Components of a Computer System   225
5.2  
Memory
5.2.1   and Cache   227
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
x Contents

Special Interest Box: Powers of 10    230


Input/Output and Mass Storage    238
5.2.2  
Practice Problems   239
Practice Problems   244
The Arithmetic/Logic Unit   245
5.2.3  
The Control Unit   249
5.2.4  
Practice Problems   256
5.3  Putting the Pieces Together—the Von Neumann
Architecture   258
Special Interest Box: An Alphabet Soup of Speed
Measures: MHz, GHz, MIPS, and GFLOPS    264
Laboratory Experience 9   265
5.4   Non–Von Neumann Architectures   265
Special Interest Box: Speed to Burn    269
5.5   Summary of Level 2   271
Special Interest Box: Quantum Computing   272
EXERCISES   273
CHALLENGE WORK   276

LEVEL 3 The Virtual Machine   278


Chapter 6 An Introduction to System Software and
Virtual Machines   280
Introduction   280
6.1  
System Software   282
6.2  
The Virtual Machine   282
6.2.1  
Types of System Software    284
6.2.2  
Assemblers and Assembly Language   286
6.3  
6.3.1   Assembly Language   286
Practice Problems   294
6.3.2  Examples of Assembly Language
Code   295
Practice Problems   299
Laboratory Experience 10   300
6.3.3  Translation and Loading   300
Practice Problems   307
6.4  Operating Systems   308
6.4.1   Functions of an Operating System    308
Special Interest Box: A Machine for the Rest of Us    311
Practice Problems   315
6.4.2   Historical Overview of Operating ­Systems
Development   318
Special Interest Box: Now That’s Big!    320
6.4.3   The Future   327
Special Interest Box: Gesture-Based Computing   330
EXERCISES   331
Challenge Work   334
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents xi

Chapter 7 Computer Networks and Cloud


Computing   336
Introduction   336
7.1  
Basic Networking Concepts   338
7.2  
Communication
7.2.1   Links   338
Special Interest Box: The Internet of Things    345
Practice Problems   346
7.2.2  Local Area Networks   346
Practice Problems   349
7.2.3  Wide Area Networks   349
7.2.4  Overall Structure of the Internet    351
Special Interest Box: Firewalls   354
7.3  Communication Protocols   356
7.3.1  Physical Layer   357
7.3.2  Data Link Layer   358
Practice Problems   362
7.3.3  Network Layer   363
Special Interest Box: I Can’t Believe We’ve Run Out    364
7.3.4  Transport Layer   366
Practice Problems   367
7.3.5  Application Layer   371
7.4  Network Services and Benefits   374
Laboratory Experience 11   375
7.4.1  Interpersonal Communications   375
7.4.2  Social Networking   376
7.4.3  Resource Sharing   376
7.4.4  Electronic Commerce   378
7.5   Cloud Computing   379
7.6   A History of the Internet and the World Wide
Web   382
7.6.1  The Internet   382
7.6.2  The World Wide Web    387
Special Interest Box: Geography Lesson   388
Special Interest Box: Net Neutrality   389
7.7   Conclusion   390
EXERCISES   390
CHALLENGE WORK   393

Chapter 8 Information Security   394


Introduction   394
8.1  
Threats and Defenses   395
8.2  
8.2.1  Authentication and Authorization   396
Special Interest Box: The Metamorphosis of Hacking    397
Practice Problems   401
8.2.2  Threats from the Network    402
Special Interest Box: Beware the Trojan Horse    403
Special Interest Box: Your Money or Your Files    404
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xii Contents

Special Interest Box: Defense against the Dark Arts   406


Practice Problem   407
8.2.3  White Hats vs. Black Hats    407
8.3  Encryption   407
Special Interest Box: You’ve Been Hacked    408
8.3.1  Encryption Overview   409
8.3.2  Simple Encryption Algorithms   410
Practice Problems   412
Laboratory Experience 12   413
8.3.3  DES   413
Special Interest Box: Hiding in Plain Sight    413
8.3.4  Public-Key Systems   417
Special Interest Box: Quantum Computing vs. RSA    419
Practice Problem   419
8.4  Web Transmission Security   420
8.5  Embedded Computing   422
Special Interest Box: Mischief-Makers in the Internet
of Things   425
8.6  Conclusion   425
8.7  Summary of Level 3   426
EXERCISES   427
CHALLENGE WORK   429

LEVEL 4 The Software World   432


Chapter 9 Introduction to High-Level Language
Programming   434
The Language Progression   434
9.1  
Where
Do We Stand and What Do We
9.1.1  
Want?   435
9.1.2  Getting Back to Binary    438
9.2  A Family of Languages   439
Special Interest Box: Ada, C11, C#, Java,
and Python Online Chapters    439
9.3  Two Examples in Five-Part Harmony   440
9.3.1  Favorite Number   440
9.3.2  Data Cleanup (Again)   444
9.4   Feature Analysis   454
9.5   Meeting Expectations   454
9.6   The Big Picture: Software Engineering   463
9.6.1  Scaling Up   464
9.6.2  The Software Development Life Cycle    464
Special Interest Box: Vital Statistics for Real Code    466
9.6.3  Modern Environments   472
9.6.4  Agile Software Development   474

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents xiii

Special Interest Box: Software Engineering Failures    475


9.7  Conclusion   476
EXERCISES   477
CHALLENGE WORK   477

Online Chapters
This text includes five language-specific online-only downloadable
chapters on Ada, C++, C#, Java, and Python, available on the com-
panion site for this text (www.cengage.com) and in MindTap.

Chapter 10 The Tower of Babel: Programming


Languages   480
Why Babel?   480
10.1  
Procedural Languages   482
10.2  
Plankalkül   482
10.2.1  
10.2.2  Fortran   483
COBOL   484
10.2.3  
Special Interest Box: Old Dog, New Tricks #1    485
Practice Problems   486
Practice Problem   487
Special Interest Box: Uncle Sam Wants Who?   487
10.2.4  C/C11   488
Practice Problems   492
10.2.5  Ada   492
Practice Problem   493
10.2.6  Java   494
Practice Problem   496
10.2.7  Python   496
10.2.8  C# and .NET   497
Practice Problem   497
Special Interest Box: The “Popularity” Contest    498
Special Interest Box: Old Dog, New Tricks #2    500
Practice Problem   501
10.3  Special-Purpose Languages   501
10.3.1  SQL   501
10.3.2  HTML   502
Laboratory Experience 13   505
10.3.3  JavaScript   505
Special Interest Box: Beyond HTML   506
Special Interest Box: PHP   509
Practice Problems   509
10.3.4  R   510

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xiv Contents

Alternative Programming Paradigms   513


10.4  
Functional
10.4.1   Programming   513
Special Interest Box: It’s All in How You
Look, Look, Look, . . . at It    518
Practice Problems   519
Laboratory Experience 14   520
10.4.2  Logic Programming   520
Practice Problems   525
10.4.3  Parallel Programming   526
Special Interest Box: New Dogs, New Tricks    531
Practice Problems   532
10.5  New Languages Keep Coming   532
10.5.1  Go   532
Special Interest Box: Go is Going Places    533
10.5.2  Swift   534
10.5.3  Milk   535
10.6  Conclusion   535
EXERCISES   537
Challenge Work   540

Chapter 11 Compilers and Language Translation    542


Introduction   542
11.1  
The Compilation Process   545
11.2  
Phase
I: Lexical Analysis    546
11.2.1  
Phase
II: Parsing   550
11.2.2  
Practice Problems   550
Practice Problems   556
Practice Problems   567
11.2.3  Phase III: Semantics and Code
­Generation   568
Practice Problem   577
11.2.4   Phase IV: Code Optimization    577
Laboratory Experience 15   577
Special Interest Box: “Now I Understand,”
Said the Machine   582
11.3   Conclusion   583
EXERCISES   584
CHALLENGE WORK   587

Chapter 12 Models of Computation   588


12.1   Introduction   588
12.2   What Is a Model?   589
12.3  A Model of a Computing Agent   591
Properties
12.3.1  of a Computing Agent    591
Practice Problems   592
12.3.2  The Turing Machine   593
Special Interest Box: Alan Turing, Brilliant Eccentric    593
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents xv

Practice Problems   600
12.4   A Model of an Algorithm   602
12.5   Turing Machine Examples   604
12.5.1  A Bit Inverter   605
Practice Problems   607
12.5.2  A Parity Bit Machine    607
12.5.3  Machines for Unary Incrementing    610
Practice Problem   610
12.5.4  A Unary Addition Machine    614
Practice Problems   616
Laboratory Experience 16   616
12.6   The Church–Turing Thesis   617
Special Interest Box: The Turing Award    618
12.7   Unsolvable Problems   621
Special Interest Box: Couldn’t Do, Can’t Do, Never
Will Be Able to . . .    626
Practice Problems   626
Laboratory Experience 17   627
12.8   Conclusion   627
12.9   Summary of Level 4   628
EXERCISES   629
CHALLENGE WORK   633

LEVEL 5 Applications   636
Chapter 13 Simulation and Modeling   638
Introduction   638
13.1  
Computational Modeling   639
13.2  
Introduction
13.2.1   to Systems and Models    639
Computational
13.2.2   Models, Accuracy,
and Errors   642
13.2.3  An Example of Model Building    644
Practice Problems   653
Laboratory Experience 18   654
13.3  Running the Model and Visualizing Results   654
13.4   Conclusion   664
Special Interest Box: The Mother of All
Computations!   664
EXERCISES   665
CHALLENGE WORK   667

Chapter 14 Ecommerce, Databases, and Data


Science   670
Introduction   670
14.1  
Ecommerce   671
14.2  
Special Interest Box: Shopping on the Web    672
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xvi Contents

Decisions, Decisions   673
14.2.1  
Anatomy of a Transaction    675
14.2.2  
Special Interest Box: A Rose by Any Other Name. . .    677
14.2.3  Designing Your Website   680
Special Interest Box: Less Is More    682
14.2.4  Behind the Scenes   682
Practice Problems   683
14.2.5  Other Ecommerce Models   683
14.2.6  Electronic Payment Systems   685
Special Interest Box: Blockchain: A New Revolution?    687
14.3  Databases   688
14.3.1  Data Organization   688
14.3.2  Database Management Systems   690
14.3.3  Other Considerations   696
Special Interest Box: SQL, NoSQL, NewSQL    697
Practice Problems   698
Laboratory Experience 19   699
14.4  Data Science   699
14.4.1  Tools   700
Special Interest Box: Algorithm Bias   703
Practice Problem   704
14.4.2  Personal Privacy   704
Special Interest Box: What Your Smartphone
Photo Knows   705
14.4.3  For the Greater Good    706
14.5  Conclusion   707
EXERCISES   708
CHALLENGE WORK   711

Chapter 15 Artificial Intelligence   712


Introduction   712
15.1  
Special Interest Box: Victory in the Turing Test?    714
15.2  A Division of Labor   715
Special Interest Box: Predicted AI Milestones     718
15.3  Knowledge Representation   718
Practice Problems   722
15.4  Recognition Tasks   723
Special Interest Box: Brain on a Chip     728
Laboratory Experience 20   729
Practice Problems   730
15.5  Reasoning Tasks   730
15.5.1  Intelligent Searching   730
15.5.2  Swarm Intelligence   733
Special Interest Box: Robot Swarms   734
15.5.3  Intelligent Agents   734
15.5.4  Expert Systems   736

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents xvii

Practice Problems   739
15.5.5  The Games We Play    739
15.6  Robots and Drones   744
15.6.1  Robots   744
Special Interest Box: Wait—Where Am I?    746
15.6.2  Drones   749
15.7  Conclusion   751
EXERCISES   752
CHALLENGE WORK   754

Chapter 16 Computer Graphics and Entertainment: Movies,


Games, and Virtual Communities   758
Introduction   758
16.1  
Computer-Generated Imagery (CGI)   761
16.2  
16.2.1  Introduction
to CGI   761
Special Interest Box: Computer Horsepower   763
16.2.2  How It’s Done: The Graphics
Pipeline   763
16.2.3   Object Modeling   764
16.2.4   Object Motion   767
Practice Problem   768
Practice Problem   772
16.2.5   Rendering and Display   772
16.2.6   The Future of CGI    775
16.3  Video Gaming   776
Special Interest Box: The Good, the Bad, and
the Ugly   780
16.4  Multiplayer Games and Virtual Communities   781
16.5   Conclusion   783
Special Interest Box: The Computer Will See You
Now   784
16.6   Summary of Level 5   785
Exercises   786
Challenge Work   788

LEVEL 6 Social Issues in Computing   790


Chapter 17 Making Decisions about Computers,
Information, and Society   792
Introduction   792
17.1  
Case Studies   793
17.2  
17.2.1  Case 1: Is It Sharing or Stealing?    793
Special Interest Box: Death of a Dinosaur    797
Practice Problems   800
Special Interest Box: The Sound of Music    801

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xviii Contents

17.2.2  Case
2: Legalized Snooping—Privacy vs.
Security   801
Special Interest Box: Hero or Traitor?    803
Practice Problems   809
Case 3: Hackers—Public Enemies
17.2.3  
or Gadflies?   809
Practice Problems   815
17.2.4  Case 4: Genetic Information
and Medical Research   815
Special Interest Box: Professional Codes of Conduct    821
17.3  Personal Privacy and Social Media   822
Practice Problems   826
17.4   Fake News, Politics, and Social Media   827
17.5   Conclusion   830
17.6   Summary of Level 6   830
EXERCISES   831

Answers to Practice Problems   833


Index   877

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface to the Eighth
Edition

Overview
This text is intended for a one-semester introductory course in computer
science. It presents a broad-based overview of the discipline that assumes
no prior background in computer science, programming, or mathematics. It
would be appropriate for a college or university service course for students
not majoring in computer science, as well as for schools that implement
their first course for majors using a breadth-first approach that surveys the
fundamental aspects of computer science. It would be highly suitable for
a high school computer science course, especially the AP Computer Sci-
ence Principles course created by the College Board in cooperation with
the National Science Foundation and colleges and universities around the
United States.

The Non-Majors Service Course


The introductory computer science service course (often called CS 0) has
undergone numerous changes. In the 1970s and early 1980s, it was usu-
ally a class in FORTRAN, BASIC, or Pascal programming. In the mid-to-late
1980s, a rapid increase in computer use caused the service course to evolve
into something called “computer literacy,” in which students learned about
new applications of computing in fields such as business, medicine, law,
and education. With the growth of personal computers and productivity
software, a typical early to mid-1990s version of this course would teach
students how to use word processors, databases, spreadsheets, and email.
The most recent change was its evolution into a web-centric course in which
students learned to design and implement webpages using HTML, XML,
ASP, and Java applets.
In many institutions, the computer science service course is evolving
once again. There are two reasons for this change. First, virtually all col-
lege and high school students are familiar with personal computers and

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202 xix
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xx Preface to the Eighth Edition

productivity software. They have been using word processors and search
engines since elementary school and are familiar with social media, online
retailing, and email; many have designed webpages and even manage their
own websites and blogs. In today’s world, a course that focuses on comput-
ing applications would be of little or no interest.
But a more important reason for rethinking the structure of the CS 0
service course, and the primary reason why we authored this book, is the
following observation:
Most computer science service courses do not teach students the foun-
dations and fundamental concepts of computer science!
We believe that students in a computer science service course should receive
a solid grounding in the fundamental concepts of the discipline, just as
introductory courses in biology, physics, and geology present the central
concepts of their fields. Topics in a breadth-first computer science service
course would not be limited to “fun” applications such as webpage creation,
blogging, game design, and interactive graphics, but would also cover foun-
dational issues such as algorithms, abstraction, hardware, computer organi-
zation, system software, language models, and the social and ethical issues
of computing. An introduction to these core ideas exposes students to the
overall richness and beauty of the field and allows them not only to use
computers and software effectively, but also to understand and appreciate
the basic ideas underlying the discipline of computer science and the cre-
ation of computational artifacts. As a side benefit, students who complete
such a course will have a much better idea of what a major or a minor in
computer science will entail.
This last point was the primary reason for the development of the AP
Computer Science Principles high school course, which is quite similar to
the breadth-first overview model just described. By learning about the field
in its entirety, rather than seeing only the small slice of it called “program-
ming,” high school students will be in a better position to decide if computer
science is a subject they wish to study when they begin college.

The First Course for Majors


Since the emergence of computer science as an academic discipline in the
1960s, the first course in the major (often called CS 1) has usually been an
introduction to programming—from Fortran to BASIC to Pascal, and, later,
C++, Java, and Python. But today there are numerous alternatives, including
a breadth-first overview. A first course for computer science majors using the
breadth-first model emphasizes early exposure to the field’s sub-­disciplines
rather than placing exclusive emphasis on programming. This gives new
majors a complete and well-rounded understanding of the field, including
the concepts and ways of thinking that are part of computer science.
Our book—intended for either majors or non-majors—is organized around
this breadth-first approach as it presents a wide range of subject matter
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface to the Eighth Edition xxi

drawn from diverse areas of computer science. However, to avoid drowning


students in a sea of seemingly unrelated facts and details, a breadth-first
presentation must be carefully woven into a coherent fabric, a theme, a “big
picture” that ties together the individual topics and presents computer sci-
ence as a unified and integrated discipline. To achieve this, our text divides
the study of computer science into a hierarchy of six subareas, called layers,
with each layer building upon concepts presented in earlier chapters.

A Hierarchy of Abstractions
The central theme of this book is that computer science is the study of
­algorithms. Our hierarchy utilizes this definition by initially looking at the
algorithmic foundations of computer science and then moving upward from
this central theme to higher-level issues such as hardware, systems, software,
applications, and ethics.
The six levels in our computer science hierarchy are:
Level 1. The Algorithmic Foundations of Computer Science
Level 2. The Hardware World
Level 3. The Virtual Machine
Level 4. The Software World
Level 5. Applications
Level 6. Social Issues in Computing

Level 1
Following an introductory chapter, Level 1 (Chapters 2–3) introduces “The
Algorithmic Foundations of Computer Science,” the bedrock on which all
other aspects of the discipline are built. It presents fundamental ideas such as
the design of algorithms, algorithmic problem solving, abstraction, pseudo-
code, and iteration and illustrates these ideas using well-known examples. It
also introduces the concepts of algorithm efficiency and asymptotic growth
and demonstrates that not all algorithms are, at least in terms of running
time, created equal.
The discussions in Level 1 assume that our algorithms are executed by
something called a “computing agent,” an abstract concept for any entity
that can carry out the instructions in our solution.

Level 2
However, in Level 2 (Chapters 4–5), “The Hardware World,” we want our
algorithms to be executed by “real” computers to produce “real” results.
Thus begins our discussion of hardware, logic design, and computer orga-
nization. The initial discussion introduces the basic building blocks of com-
puter ­systems—binary numbers, Boolean logic, gates, and circuits. It then
shows how these elementary concepts can be combined to construct a real
computer using the Von Neumann architecture, composed of processors,
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxii Preface to the Eighth Edition

memory, and input/output. This level presents a simple machine language


instruction set and explains how the algorithmic primitives of Level 1,
such as assignment and conditional, can be implemented in machine lan-
guage and run on the Von Neumann hardware of Level 2, conceptually
tying together these two areas. It ends with a discussion of important new
directions in hardware design—multicore processors and massively parallel
machines.
By the end of Level 2, students have been introduced to basic concepts
in logic design and computer organization, and they can appreciate the
complexity inherent in these ideas.

Level 3
This complexity is the motivation for the material contained in Level 3
(Chapters 6–8), “The Virtual Machine.” This section describes how system
software is used to create a user-friendly, user-oriented problem-solving
environment that hides many of the ugly hardware details just described.
Level 3 looks at the same problems discussed in Level 2, encoding and
executing algorithms, but shows how this can be done easily in a virtual
environment containing helpful tools like a graphical user interface, editors,
language translators, file systems, and debuggers. This section discusses the
services and responsibilities of the operating system and how it has evolved.
It investigates one of the most important virtual environments in current
use, computer networks, and shows how technologies such as Ethernet, the
Internet, and the web link together independent systems via transmission
media and communications software. This creates a virtual environment in
which we seamlessly and transparently use not only the computer on our
desk or in our hand, but also computing devices located around the world.
This transparency has progressed to the point where we can now use sys-
tems located “in the cloud” without regard for where they are, how they
provide their services, and even whether they exist as real physical entities.
Level 3 concludes with a look at one of the most important services provided
by a virtual machine, namely information security, and describes algorithms
for protecting the user and the system from accidental or malicious damage.

Level 4
Once we have created this powerful user-oriented virtual environment, what
do we want to do with it? Most likely we want to write programs to solve
interesting problems. This is the motivation for Level 4 (Chapters 9–12), “The
Software World.” Although this book should not be viewed as a program-
ming text, it contains an overview of the features found in modern procedural
programming languages. This gives students an appreciation for the inter-
esting and challenging task of the computer programmer and the power of
the problem-solving environment created by a modern high-level language.
(More detailed introductions to five important high-level programming lan-
guages are available via online, downloadable chapters accessible through
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface to the Eighth Edition xxiii

MindTap, as well as at www.cengage.com.) There are many different language


models, so Level 4 also includes a discussion of other language types, includ-
ing special-purpose languages such as SQL, HTML, JavaScript, and R, as well
as the functional, logic, and parallel language paradigms. An introduction to
the design and construction of a compiler shows how high-level languages
can be translated into machine language for execution. This latter discussion
ties together numerous ideas from earlier chapters, as we show how an algo-
rithm (Level 1), expressed in a high-level language (Level 4), can be compiled
and executed on a typical Von Neumann machine (Level 2) using system
software tools (Level 3). These “recurring themes” and frequent references to
earlier concepts help reinforce the idea of computer science as an integrated
set of topics. At the conclusion of Level 4, we introduce the idea of comput-
ability and insolvability to show students that there are provable limits to
what programs, computers, and computer science can achieve.

Level 5
We now have a high-level programming environment in which it is possible
to write programs to solve important problems. In Level 5 (Chapters 13–16),
“Applications,” we take a look at some important uses of computers. There is
no way to cover more than a fraction of the many applications of computers
and information technology in a single section. We have included applica-
tions drawn from the sciences and engineering (simulation and modeling),
business and finance (ecommerce, databases, data science), the social sci-
ences (artificial intelligence), and everyday life (computer-generated imag-
ery, video gaming, virtual communities). Our goal is to show students that
these applications are not “magic boxes” whose inner workings are totally
unfathomable. Rather, they are the direct result of building upon the core
concepts of computer science presented in the previous chapters.

Level 6
Finally, we reach the highest level of study, Level 6 (Chapter 17), “Social
Issues in Computing,” which addresses the social, ethical, moral, and legal
issues raised by pervasive computer technology. This section, based on con-
tributions by Professor Bo Brinkman of Miami University, examines issues
such as the theft of intellectual property, national security concerns, the
erosion of personal privacy, and the political impact of the proliferation of
fake news distributed using social media. This chapter does not attempt to
provide easy solutions to these many-faceted problems. Instead, it focuses
on techniques that students can use to think about ethical issues and reach
their own conclusions. Our goal in this final section is to make students
aware of the enormous impact that information technology is having on our
society and to give them tools for making informed decisions.
This, then, is the hierarchical structure of our text. It begins with the
algorithmic foundations of the discipline and works its way from lower-
level hardware concepts through virtual machine environments, high-level
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxiv Preface to the Eighth Edition

languages, software, and applications, to the social issues raised by com-


puter technology. This organizational structure, along with the use of recur-
ring themes, enables students to view computer science as a unified and
coherent field of study. The material in Chapters 1–12 is intended to be
covered sequentially, but the applications discussed in Chapters 13–16 can
be covered in any order and the social issues in Chapter 17 can be presented
at any time.

What’s New in This Edition


This eighth edition of Invitation to Computer Science addresses a number
of emerging issues in computer science. We have added new material on
ransomware, code repositories, electronic payment systems, new program-
ming languages such as R and Milk, data science, artificial intelligence, and
drones. There is an entirely new section on fake news, politics, and social
media.
New and updated Special Interest Boxes highlight interesting historical
vignettes, new developments in computing, biographies of important people in
the field, and news items showing how computing affects our everyday lives.

An Interactive Experience—
MindTap
This edition offers significantly enhanced supplementary material and addi-
tional resources available online through MindTap. MindTap, an online
teaching and learning solution, helps students be more successful and con-
fident in the course and in their real life. MindTap guides students through
the course by combining the complete textbook with interactive multimedia
activities, assessments, and learning tools. Readings and activities engage
students in learning core concepts, practicing needed skills, and applying
what they learn. Instructors can rearrange and add content to personalize
their MindTap course, and easily track students’ progress with real-time
analytics. MindTap integrates seamlessly with any learning management
system.

An Experimental Science—
Laboratory Software and Manual
Another important aspect of computer science education is the realization
that, like such scientific fields as physics, chemistry, and biology, computer
science is an empirical, laboratory-based discipline in which learning comes
not only from watching and listening but also from doing and trying. Many
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface to the Eighth Edition xxv

ideas in computer science cannot be fully understood and appreciated until


they are visualized, manipulated, and tested. Today, most computer science
faculty see structured laboratories as an essential part of an introductory
course, and this view is fully reflected in our approach to the material.
Associated with this text is a laboratory manual and custom-designed
laboratory software that enables students to experiment with the concepts
we present. The manual contains 20 laboratory experiences, closely coor-
dinated with the main text, that cover all levels except Level 6. These
labs give students the chance to observe, study, analyze, and modify an
important concept. For example, associated with Level 1 (the algorithmic
foundations of computer science) are experiments that animate the algo-
rithms in Chapters 2 and 3 and ask students to observe and discuss what
is happening in these animations. There are also labs that allow students
to measure the running time of these algorithms for different-sized data
sets and discuss their behavior, thus providing concrete observations of an
abstract concept like algorithmic efficiency. There are similar labs available
for Levels 2, 3, 4, and 5 that highlight and clarify the material presented
in the text.
Each lab experiment includes an explanation of how to use the software,
a description of how to conduct the experiment, and problems for students
to complete. For these lab projects, students can either work on their own or
in teams, and the course may utilize either a closed-lab (formal, scheduled)
or open-lab (informal, unscheduled) setting. The manual and software work
well with all these laboratory models. The text contains “Laboratory Exer-
cise” boxes that describe each lab and identify the point in the text where it
would be most appropriate.
In this new eighth edition, the Laboratory Manual has been integrated
into the MindTap for this text.

Programming and Online


Language Modules
Programming concepts are presented in the text in the form of a survey of
the features each high-level language provides and how they differ based
on the computing tasks for which they were intended. Code examples are
shown only to illustrate how algorithms can be embedded into the vary-
ing syntax of different languages. For instructors who want their students
to have additional programming experience, online language modules for
Ada, C++, C#, Java, and Python are available. Students may download any
or all of these for free by going to www.cengage.com. These PDF docu-
ments can be read online, downloaded to the student’s computer, or printed.
Each chapter includes language-specific practice problems and exercises.
The exercises are also included in our educational Integrated Development
Environment (IDE) within MindTap. This exposes your students to an impor-
tant developer tool.
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxvi Preface to the Eighth Edition

Computer science is a young and exciting discipline, and we hope that


the new material in this edition, along with the laboratory projects and
online modules, will convey this feeling of excitement to students.

Instructor Resources
The following supplemental teaching tools are available when this book is
used in a classroom setting. All supplements are available to instructors for
download at www.cengage.com.

Instructor’s Manual
The Instructor’s Manual follows the text chapter by chapter and includes
material to assist in planning and organizing an effective, engaging course.
The Instructor’s Manual includes Overviews, Learning Objectives, Teaching
Tips, Quick Quizzes, Class Discussion Topics, Additional Projects, Additional
Resources, and Key Terms. A sample syllabus is also available.

Solutions
Complete solutions to chapter exercises are provided online for instructors.

Test Bank
Cengage Learning Testing, powered by Cognero, is a flexible, online system
that allows instructors to:
• Author, edit, and manage test bank content from multiple Cengage
Learning solutions
• Create multiple test versions in an instant
• Deliver tests from your Learning Management System (LMS), your
classroom, or anywhere you want

PowerPoint Presentations
Microsoft PowerPoint slides to accompany each chapter are available. Slides
may be used to guide classroom presentation or to print as classroom hand-
outs, or they may be made available to students for chapter review. Instruc-
tors may customize the slides to best suit their course.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface to the Eighth Edition xxvii

Acknowledgments
The authors would like to thank Bo Brinkman, Ph.D., Miami University, for
his contributions to the Social Issues in Computing content. The authors
would also like to thank Deb Kaufmann and Emma Newsom for their invalu-
able assistance in developing this new edition, as well as the reviewers for
this edition, whose comments were very helpful.
• Travis Dalton, Columbia College
• Debbie Collins, Black Hawk College
• Barry Poulson, University of Colorado, Boulder
• Akira Kawaguchi, The City College of New York
• H. Paul Haiduk, West Texas A&M University
• Melissa Stange, Lord Fairfax Community College
• Tom Schendl, Benedictine University
Any errors, of course, are the fault solely of the authors.

—G. Michael Schneider


Macalester College
schneider@macalester.edu

—Judith L. Gersting
Indiana University-Purdue University at Indianapolis
gersting@iupui.edu

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CHAPTER

1
An Introduction to
Computer Science

CHAPTER TOPICS After studying this chapter,


1.1 Introduction you will be able to:
1.2 The Definition of
• Understand the definition of the term algorithm
Computer Science
• Understand the formal definition of computer science
1.3 Algorithms
• Write down everyday algorithms
1.3.1 The Formal
Definition of an • Determine if an algorithm is ambiguous or not effectively computable
Algorithm
• Understand the roots of modern computer science in mathematics
1.3.2 The Importance and mechanical machines
of Algorithmic
Problem Solving • Summarize the key points in the historical development of modern
electronic computers
1.4 A Brief History of
Computing
1.4.1 The Early Period:
Up to 1940 1.1 Introduction
1.4.2 The Birth of This text is an invitation to learn about one of the youngest and most excit-
Computers: ing scientific disciplines—computer science. Almost every day our newspa-
1940–1950
pers, televisions, and electronic media carry reports of significant advances
1.4.3 The Modern in computing, such as high-speed supercomputers that perform more than
Era: 1950 to the 90 quadrillion (1015) mathematical operations per second; wireless networks
Present
that stream high-definition video and audio to the remotest corners of the
1.5 Organization of globe in fractions of a second; minute computer chips that can be embedded
the Text into appliances, clothing, and even our bodies; and artificial intelligence
Laboratory systems that understand and respond to English language questions faster
Experience 1 and more accurately than humans. The next few years will see technologi-
cal breakthroughs that, until a few years ago, existed only in the minds of
EXERCISES dreamers and science fiction writers. These are exciting times in computing,
CHALLENGE WORK and our goal in this text is to provide you with an understanding of com-
puter science and an appreciation for the diverse areas of research and study
within this important field.
Although the average person can produce a reasonably accurate descrip-
tion of most scientific fields, even if he or she did not study the subject in
school, many people do not have an intuitive understanding of the types of
problems studied by computer science professionals. For example, you prob-
ably know that biology is the study of living organisms and that chemistry
deals with the structure and composition of matter. However, you might
not have the same fundamental understanding of the work that goes on in
computer science. In fact, many people harbor one or more of the following
common misconceptions about this field.
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Misconception 1: Computer science is the study of computers.
This apparently obvious definition is actually incorrect or, to put it more
precisely, incomplete. For example, some of the earliest and most fundamen-
tal theoretical work in computer science took place from 1920 to 1940, many
years before the development of the first computer system. (This p ­ ioneering
work was initially considered a branch of logic and applied mathematics.
Computer science did not come to be recognized as a separate and inde-
pendent field of scientific study until the late 1950s and early 1960s.) Even
today, there are branches of computer science quite distinct from the study
of “real” machines. In theoretical computer science, for example, researchers
study the logical and mathematical properties of problems and their solu-
tions. Frequently, these researchers investigate problems not with actual
computers but rather with formal models of computation, which are easier
to study and analyze mathematically. Their work involves pencil and paper,
not circuit boards and disks.
This distinction between computers and computer science was beauti-
fully expressed by computer scientists Michael R. Fellows and Ian Parberry
in an article in the journal Computing Research News:
Computer science is no more about computers than astronomy is about
telescopes, biology is about microscopes, or chemistry is about beakers
and test tubes. Science is not about tools. It is about how we use them
and what we find out when we do.1

 isconception 2: Computer science is the study of how to write computer


M
programs.
Many people are introduced to computer science when learning to write
programs in a language such as C++, Python, or Java. This almost universal
1
Fellows, M. R., and Parberry, I. “Getting Children Excited About Computer Science,”
­Computing Research News, vol. 5, no. 1 (January 1993).
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202 3
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
4 Chapter 1 An Introduction to Computer Science

use of programming as the entry to the discipline can create the misunder-
standing that computer science is equivalent to computer programming.
Programming is extremely important to the discipline—researchers use it
to study new ideas and build and test new solutions—but, like the computer
itself, programming is a tool. When computer scientists design and analyze
a new approach to solving a problem or create new ways to ­represent infor-
mation, they often implement their ideas as programs to test them on an
actual computer system. This enables researchers to see how well these new
ideas work and whether they perform better than previous methods.
For example, searching a list is one of the most common applications of
computers, and it is frequently applied to huge problems, such as finding one
specific account among the approximately 63,000,000 active listings in the
Social Security Administration database. A more efficient lookup method could
significantly reduce the time that telephone-based customers must wait before
receiving answers to questions regarding their accounts. Assume that we have
designed what we believe to be a “new and improved” search technique. After
analyzing it theoretically, we would study it empirically by writing a program
to implement our new method, executing it on our computer, and measuring
its performance. These tests would demonstrate under what conditions our new
method is or is not faster than the search procedures currently in use.
In computer science, it is not simply the construction of a high-quality
program that is important but also the methods it embodies, the services it
provides, and the results it produces. It is possible to become so enmeshed
in writing code and getting it to run that we forget that a program is only a
means to an end, not an end in itself.
Misconception 3: Computer science is the study of the uses and applica-
tions of computers and software.
If one’s introduction to computer science is not programming, then it
might be a course on the application of computers and software. Such a
course typically teaches the use of a number of popular packages, such as
word processors, search engines, database systems, spreadsheets, presenta-
tion software, smartphone apps, and web browsers.
These packages are widely used by professionals in all fields. However,
learning to use a software package is no more a part of computer science
than driver’s education is a branch of automotive engineering. A wide range
of people use computer software, but it is the computer scientist who is
responsible for specifying, designing, building, and testing these software
packages as well as the computer systems on which they run.
These three misconceptions about computer science are not entirely
wrong; they are just woefully incomplete. Computers, programming lan-
guages, software, and applications are part of the discipline of computer

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 An Introduction to Computer Science 5

science, but neither individually nor combined do they capture the richness
and diversity of this field.
We have spent a good deal of time saying what computer science is not.
What, then, is it? What are its basic concepts? What are the fundamental
questions studied by professionals in this field? Is it possible to capture the
breadth and scope of the discipline in a single definition? We answer these
fundamental questions in the next section and, indeed, in the remainder of
the text.

In the Beginning . . .

There is no single date that marks the beginning of computer science. Indeed,
there are many “firsts” that could be used to mark this event. For example, some
of the earliest theoretical work on the logical foundations of computer science
occurred in the 1930s. The first general-purpose, electronic computers appeared
during the period 1940–1946. (We will discuss the history of these early machines
in Section 1.4.) These first ­computers were one-of-a-kind experimental systems
that never moved outside the research laboratory. The first commercial machine,
the UNIVAC I, did not make its appearance until March 1951, a date that marks
the real beginning of the computer industry. The first high-level (i.e., based on
natural language) programming language was FORTRAN. Some people mark
its debut in 1957 as the beginning of the “software” industry. The appearance
of these new machines and languages created new occupations, such as pro-
grammer, numerical analyst, and computer engineer. To address the intellectual
needs of these workers, the first professional society for people in the field of
computing, the ­Association for Computing Machinery (ACM), was established in
1947. (The ACM has more than 100,000 members and is the largest professional
computer science society in the world. Its home page is www.acm.org.) To help
meet the rapidly growing need for computer professionals, the first Department
of Computer Science was established at ­Purdue University in October 1962. It
awarded its first M.Sc. degree in 1964 and its first Ph.D. in computer science in
1966. An undergraduate program was established in 1967.
Thus, depending on what you consider the most important “first,” the field
of ­computer science is somewhere between 50 and 80 years old. Compared
with such ­classic scientific disciplines as mathematics, physics, chemistry, and
biology, ­computer science is the new kid on the block.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
6 Chapter 1 An Introduction to Computer Science

1.2 The Definition of Computer


Science
There are many definitions of computer science, but the one that best cap-
tures the richness and breadth of ideas embodied in this branch of science
was first proposed by professors Norman Gibbs and Allen Tucker.2 According
to their definition, the central concept in computer science is the algorithm.
It is not possible to understand the field without a thorough understanding
of this critically important idea.
DEFINITION The Gibbs and Tucker definition says that it is the task of the computer
Computer science: the scientist to design and develop algorithms to solve a range of important
study of algorithms, problems. This design process includes the following operations:
including
1. Their formal and math- • Studying the behavior of algorithms to determine if they are correct
ematical properties and efficient (their formal and mathematical properties)
2. Their hardware • Designing and building computer systems that are able to execute
­realizations
algorithms (their hardware realizations)
3. Their linguistic
r­ ealizations • Designing programming languages and translating algorithms into
4. Their applications these languages so that they can be executed by the hardware (their
linguistic realizations)
• Identifying important problems and designing correct and efficient
software packages to solve these problems (their applications)
Because it is impossible to appreciate this definition fully without know-
ing what an algorithm is, let’s look more closely at this term. The Merriam-
Webster dictionary (www.merriam-webster.com/dictionary/ ) defines the
word algorithm as follows:
al • go • rithm n. A procedure for solving a mathematical problem in
a finite number of steps that frequently involves repetition of an opera-
tion; broadly: a step-by-step method for accomplishing some task.
Informally, an algorithm is an ordered sequence of instructions that is
guaranteed to solve a specific problem. It is a list that looks something like this:

Step 1: Do something
Step 2: Do something
Step 3: Do something
 
 
 
Step N: Stop, you are finished

2
Gibbs, N. E., and Tucker, A. B. “A Model Curriculum for a Liberal Arts Degree in Computer
Science,” Comm. of the ACM, vol. 29, no. 3 (March 1986).
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 An Introduction to Computer Science 7

If you are handed this list and carefully follow its instructions in the order
specified, when you reach the end you will have solved the task at hand.
All the operations used to construct algorithms belong to one of only
three categories:
1. Sequential operations. A sequential instruction carries out a single well-
defined task. When that task is finished, the algorithm moves on to the
next operation. Sequential operations are usually expressed as simple
­declarative sentences.
•• Add 1 cup of butter to the mixture in the bowl.
•• Subtract the amount of the check from the current account balance.
•• Set the value of x to 1.
2. Conditional operations. These are the “question-asking” instructions of
an algorithm. They ask a question, and the next operation is then selected
on the basis of the answer to that question.
•• If the mixture is too dry, then add one-half cup of water to the bowl.
•• If the amount of the check is less than or equal to the current ac-
count balance, then cash the check; otherwise, tell the person there
are insufficient funds.
•• If x is not equal to 0, then set y equal to 1/x; otherwise, print an error
message that says you cannot perform division by 0.
3. Iterative operations. These are the “looping” instructions of an algorithm.
They tell us not to go on to the next instruction but, instead, to go back
and repeat the execution of a previous block of instructions.
•• Repeat the previous two operations until the mixture has thickened.
•• While there are still more checks to be processed, do the following
five steps.
•• Repeat Steps 1, 2, and 3 until the value of y is equal to 11.
We use algorithms (although we don’t call them that) all the time—­
whenever we follow a set of instructions to assemble a child’s toy, bake a
cake, balance a checkbook, or go through the college registration process.
A good example of an algorithm used in everyday life is the set of instructions
shown in Figure 1.1 for programming a DVR to record a collection of televi-
sion shows. Note the three types of instructions in this algorithm: sequential
(Steps 3, 4, 5, and 7), conditional (Steps 1 and 6), and iterative (Step 2).
Mathematicians use algorithms all the time, and much of the work done
by early Greek, Roman, Persian, and Indian mathematicians involved the
discovery of algorithms for important problems in geometry and arithmetic;
an example is Euclid’s algorithm for finding the greatest common divisor
of two positive integers. (Exercise 10 at the end of the chapter presents this
2,300-year-old algorithm.) We also studied algorithms in elementary school,
even if we didn’t know it. For example, in the first grade we learned an
algorithm for adding two numbers such as
  47
125
  72
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
8 Chapter 1 An Introduction to Computer Science

FIGURE 1.1
Step 1 If the clock and the calendar are not correctly set, then go to page 9
of the ­instruction manual and follow the instructions there before pro-
ceeding to Step 2
Step 2 Repeat Steps 3 through 6 for each program that you want to record
Step 3 Enter the channel number that you want to record and press the
button labeled CHAN
Step 4 Enter the time that you want recording to start and press the button
­labeled TIME-START
Step 5 Enter the time that you want recording to stop and press the button
labeled TIME-FINISH. This completes the programming of one
show
Step 6 If you do not want to record anything else, press the button labeled
END-PROG
Step 7 Turn off your DVR. Your DVR is now in TIMER mode, ready to record

Programming your DVR: An example of an algorithm

The instructions our teachers gave were as follows: First add the right-
most column of numbers (7 1 5), getting the value 12. Write down the 2
under the line and carry the 1 to the next column. Now move left to the next
column, adding (4 1 2) and the previous carry value of 1 to get 7. Write this
value under the line, producing the correct answer 72.
Although as children we learned this algorithm informally, it can,
like the DVR instructions in Figure 1.1, be written formally as an explicit
sequence of instructions. Figure 1.2 shows an algorithm for adding two
positive m-digit numbers. It expresses formally the operations informally
described previously. Again, note the three types of instructions used to
construct the algorithm: sequential (Steps 1, 2, 4, 6, 7, 8, and 9), conditional
(Step 5), and iterative (Step 3).
Even though it might not appear so, this is the same “decimal addition
algorithm” that you learned in grade school; if you follow it rigorously, it is
guaranteed to produce the correct result. Let’s watch it work.


Add (47 1 25)
m52
The input
  a1 5 4    a0 5 7    
b1 5 2    b0 5 5
Step 1: carry 5 0
Step 2: i50
Step 3: We now repeat Steps 4 through 6 while i is less than or equal to 1
First repetition of the loop (i has the value 0)
Step 4: Add (a0 1 b0 1 carry), which is 7 1 5 1 0, so c0 5 12
Step 5: Because c0 $ 10, we reset c0 to 2 and reset carry to 1

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 An Introduction to Computer Science 9

FIGURE 1.2
Given: m  1 and two positive numbers each containing m digits, am21 am22 . . . a0
and bm21 bm22 . . . b0
Wanted: cm cm21 cm22 . . . c0, where cm cm21 cm22 . . . c0 5 (am21 am22 . . . a0) 1 (bm21
bm22 . . . b0)

Algorithm:
Step 1 Set the value of carry to 0
Step 2 Set the value of i to 0
Step 3 While the value of i is less than or equal to m 2 1, repeat the instruc-
tions in Steps 4 through 6
Step 4 Add the two digits ai and bi to the current value of carry to get ci
Step 5 If ci $ 10, then reset ci to (ci 2 10) and reset the value of carry to 1;
otherwise, set the new value of carry to 0
Step 6 Add 1 to i, effectively moving one column to the left
Step 7 Set cm to the value of carry
Step 8 Print out the final answer, cm cm21 cm22 . . . c0
Step 9 Stop

Algorithm for adding two m-digit numbers

Step 6:  eset i to (0 1 1) 5 1. Because i is less than or equal to 1, go back to


R
Step 4
Second repetition of the loop (i has the value 1)
Step 4: Add (a1 1 b1 1 carry), which is 4 1 2 1 1, so c1 5 7
Step 5: Because c1 , 10, we reset carry to 0
Step 6:  eset i to (1 1 1) 5 2. Because i is greater than 1, we do not repeat
R
the loop but instead go to Step 7
Step 7: Set c2 5 0
Step 8: Print out the answer c2 c1 c0 5 072 (see the boldface values)
Step 9: Stop
We have reached the end of the algorithm, and it has correctly produced
the sum of the two numbers 47 and 25, the three-digit result 072. (A more
clever algorithm would omit the unnecessary leading zero at the begin-
ning of the number if the last carry value is a zero. That modification is an
exercise—Exercise 6—at the end of the chapter.) Try working through the
algorithm shown in Figure 1.2 with another pair of numbers to be sure that
you understand exactly how it functions.
The addition algorithm shown in Figure 1.2 is a highly formalized rep-
resentation of a technique that most people learned in the first or second
grade and that virtually everyone knows how to do informally. Why would
we take such a simple task as adding two numbers and express it in so
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
10 Chapter 1 An Introduction to Computer Science

Abu Ja’far Muhammad


ibn Musa Al-Khwarizmi
(AD 780–850?)

The word algorithm is derived from the last name of


Muhammad ibn Musa Al-Khwarizmi, a famous Persian mathematician
and author from the eighth and ninth centuries. Al-Khwarizmi was a
teacher at the House of Wisdom in Baghdad and the author of the book
Kitab al jabr w’al muqabala, which in English means “The Concise Book
of Calculation by Reduction.” Written in AD 820, it is one of the ­earliest
­mathematical textbooks, and its title gives us the word algebra (the Arabic
word al jabr means “reduction”).
In AD 825, Al-Khwarizmi wrote another book about the base-10 positional
numbering system that had recently been developed in India. In this book,
he described formalized, step-by-step procedures for doing arithmetic
operations, such as addition, subtraction, and multiplication, on numbers
represented in this new decimal system, much like the addition algorithm
diagrammed in Figure 1.2. In the twelfth century, this book was translated into
Latin, introducing the base-10 Hindu–Arabic numbering system to Europe,
and Al-Khwarizmi’s name became closely associated with these formal numer-
ical techniques. His last name was rendered as Algoritmi in Latin characters,
and eventually the formalized procedures that he pioneered and developed
became known as algorithms in his honor.

c­ omplicated a fashion? Why are formal algorithms so important in com-


puter science? Because of the following fundamental idea:
If we can specify an algorithm to solve a problem, then we can automate its
solution.
Once we have formally specified an algorithm, we can build a machine
(or write a program or hire a person) to carry out the steps contained in the
algorithm. The machine (or program or person) need not understand the
concepts or ideas underlying the solution. It merely has to do Step 1, Step 2,
Step 3, . . . exactly as written. In computer science terminology, the machine,
robot, person, or thing carrying out the steps of the algorithm is called a
computing agent.
Thus, computer science can also be viewed as the science of algorith-
mic problem solving. Much of the research and development work in com-
puter science involves discovering correct and efficient algorithms for a
wide range of interesting problems, studying their properties, designing

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 An Introduction to Computer Science 11

­ rogramming languages into which those algorithms can be encoded, and


p
designing and building computer systems that can automatically execute
these algorithms in an efficient manner.
At first glance, it might seem that every problem can be solved algorith-
mically. However, you will learn in Chapter 12 the startling fact (first proved
by the German logician Kurt Gödel in the early 1930s) that there are prob-
lems for which no generalized algorithmic solution can possibly exist. These
problems are, in a sense, unsolvable. No matter how much time and effort
is put into obtaining a solution, none will ever be found. Gödel’s discovery,
which staggered the mathematical world, effectively places a limit on the
ultimate capabilities of computers and computer scientists.
There are also problems for which it is theoretically possible to specify
an algorithm but a computing agent would take so long to execute it that
the solution is essentially useless. For example, to get a computer to play
winning chess, we could adopt a brute force approach. Given a board posi-
tion as input, the computer would examine every legal move it could possi-
bly make, then every legal response an opponent could make to each initial
move, then every response it could select to that move, and so on. This anal-
ysis would continue until the game reached a win, lose, or draw position.
With that information, the computer would be able to optimally choose its
next move. If, for simplicity’s sake, we assume that there are 40 legal moves
from any given position on a chessboard, and it takes about 30 moves to
reach a final conclusion, then the total number of board positions that our
brute force program would need to evaluate in deciding its first move is
40 3 40 3 40 3 . . . 3 40 5 4030, which is roughly 1048

30 times
If we use a supercomputer that evaluates 1 quadrillion (1015) board posi-
tions per second, it would take about 30,000,000,000,000,000,000,000,000
years for the computer to make its first move! Obviously, a computer could
not use a brute force technique to play a real chess game.
There also exist problems that we do not yet know how to solve algo-
rithmically. Many of these involve tasks that require a degree of what we
term “intelligence.” For example, after only a few days a baby recognizes
the face of his or her mother from among the many faces he or she sees. In
a few months, the baby begins to develop coordinated sensory and motor
control skills and can efficiently plan how to use them—how to get from the
playpen to the toy on the floor without bumping into either the chair or the
desk that is in the way. After a few years, the child begins to develop power-
ful language skills and abstract reasoning capabilities.
We take these abilities for granted, but, even though artificial intelligence
research and implementation has made enormous strides in the past few
years, with regard to the operations just mentioned—high-level problem solv-
ing, abstract reasoning, sophisticated natural-language understanding—the
computer and software systems currently available in the marketplace have
not yet achieved the intelligence level of an adult human being. The primary
reason is that researchers do not yet know how to specify these operations

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
12 Chapter 1 An Introduction to Computer Science

algorithmically. That is, they do not yet know how to specify a solution for-
mally in a detailed step-by-step fashion. As humans, we are able to do them
simply by using the “algorithms” in our heads. To appreciate this problem,
imagine trying to describe algorithmically exactly what steps you follow
when you are painting a picture, composing a love poem, or formulating a
business plan.
Thus, algorithmic problem solving has many variations. Sometimes
solutions do not exist; sometimes a solution is too inefficient to be of
any use; sometimes a solution is not yet known. However, discovering
an ­algorithmic solution has enormously important consequences. As we
noted ­earlier, if we can create a correct and efficient algorithm to solve a
problem, and if we encode it into a programming language, then we can
take advantage of the speed and power of a computer system to automate
the solution and p ­ roduce the desired result. This is what computer science
is all about.

1.3 Algorithms
DEFINITION
Algorithm: a well-ordered
collection of unambiguous 1.3.1 The Formal Definition of an Algorithm
and effectively comput- The formal definition of an algorithm is rather imposing and contains a
able operations that, when number of important ideas. Let’s take it apart, piece by piece, and analyze
executed, produces a
result and halts in a finite
each of its separate points.
amount of time. . . .a well-ordered collection. . .
An algorithm is a collection of operations, and there must be a clear and
unambiguous ordering to these operations. Ordering means that we know
which operation to do first and precisely which operation to do next as each
step is successfully completed. After all, we cannot expect a computing
agent to carry out our instructions correctly if it is confused about which
instruction it should be doing next.
Consider the following “algorithm” that was taken from the back of a
shampoo bottle and is intended to be instructions on how to use the product.

Step 1: Wet hair


Step 2: Lather
Step 3: Rinse
Step 4: Repeat

At Step 4, what operations should be repeated? If we go back to Step 1, we


will be unnecessarily wetting our hair. (It is presumably still wet from the
previous operations.) If we go back to Step 3 instead, we will not be getting
our hair any cleaner because we have not reused the shampoo. The Repeat
instruction in Step 4 is ambiguous in that it does not clearly specify what to

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 An Introduction to Computer Science 13

do next. Therefore, it violates the well-ordered requirement of an algorithm.


(It also has a second and even more serious problem—it never stops! We will
have more to say about this second problem shortly.) Statements such as
• Go back and do it again. (Do what again?)
• Start over. (From where?)
• If you understand this material, you may skip ahead. (How far?)
• Do either Part 1 or Part 2. (How do I decide which one to do?)
are ambiguous and can leave us confused and unsure about what operation
to do next. We must be extremely precise in specifying the order in which
operations are to be carried out. One possible way is to number the steps of
the algorithm and use these numbers to specify the proper order of execu-
tion. For example, the ambiguous operations just shown could be made
more precise as follows:
• Go back to Step 3 and continue execution from that point.
• Start over from Step 1.
• If you understand this material, skip ahead to Line 21.
• If you are 18 years of age or older, do Part 1 beginning with Step 9;
otherwise, do Part 2 beginning with Step 40.

. . .of unambiguous and effectively computable operations. . .


Algorithms are composed of things called “operations,” but what do
those operations look like? What types of building blocks can be used to
construct an algorithm? The answer to these questions is that the operations
used in an algorithm must meet two criteria—they must be unambiguous,
and they must be effectively computable.
Here is a possible “algorithm” for making a cherry pie:

Step 1: Make the crust


Step 2: Make the cherry filling
Step 3: Pour the filling into the crust
Step 4: Bake at 350°F for 45 minutes

For a professional baker, this algorithm would be fine. He or she would under-
stand how to carry out each of the operations listed. Novice cooks, like most
of us, would probably understand the meaning of Steps 3 and 4. However,
we would probably look at Steps 1 and 2, throw up our hands in confusion,
and ask for clarification. We might then be given more detailed instructions.

Step 1: Make the crust


1.1 Take one and one-third cups flour
1.2 Sift the flour

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
14 Chapter 1 An Introduction to Computer Science

1.3  ix the sifted flour with one-half cup butter and one-fourth cup
M
water
1.4 Roll into two 9-inch pie crusts
Step 2: Make the cherry filling
2.1 Open a 16-ounce can of cherry pie filling and pour into bowl
2.2 Add a dash of cinnamon and nutmeg, and stir

With this additional information, most people—even inexperienced


cooks—would understand what to do and could successfully carry out this
baking algorithm. However, there might be some people, perhaps young
children, who still do not fully understand each and every line. For those
people, we must go through the simplification process again and describe
the ambiguous steps in even more elementary terms.
For example, the computing agent executing the algorithm might not
know the meaning of the instruction “Sift the flour” in Step 1.2, and we
would have to explain it further.

1.2 Sift the flour


1.2.1 Get out the sifter, which is the device shown on page A-9 of
your cookbook, and place it directly on top of a 2-quart bowl
1.2.2 Pour the flour into the top of the sifter and turn the crank in a
counterclockwise direction
1.2.3 Let all the flour fall through the sifter into the bowl

Now, even a child should be able to carry out these operations. But if that were
not the case, then we would go through the simplification process yet one more
time, until every operation, every sentence, every word was clearly understood.
An unambiguous operation is one that can be understood and car-
ried out directly by the computing agent without further simplification
or ­explanation. When an operation is unambiguous, we call it a primitive
operation, or simply a primitive of the computing agent carrying out the
algorithm. An algorithm must be composed entirely of primitives. Naturally,
the primitive operations of different individuals (or machines) vary depend-
ing on their sophistication, experience, and intelligence, as is the case with
the cherry pie recipe, which varies with the baking experience of the person
following the instructions. Hence, an algorithm for one computing agent
might not be an algorithm for another.
One of the most important questions we will answer in this text is, What are
the primitive operations of a typical modern computer system? Which opera-
tions can a hardware processor “understand” in the sense of being able to carry
out directly, and which operations must be further refined and simplified?
However, it is not enough for an operation to be understandable. It must
also be doable by the computing agent. If an algorithm tells me to flap my
arms really quickly and fly, I understand perfectly well what it is asking me to
do. However, I am incapable of doing it. “Doable” means there exists a com-
putational process that allows the computing agent to complete that opera-
tion successfully. The formal term for “doable” is effectively computable.
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 An Introduction to Computer Science 15

For example, the following is an incorrect technique for finding and print-
ing the 100th prime number. (A prime number is a whole number not evenly
divisible by any numbers other than 1 and itself, such as 2, 3, 5, 7, 11, 13, . . .)

Step 1: Generate a list L of all the prime numbers: L1, L2, L3, . . .
Step 2: Sort the list L into ascending order
Step 3: Print out the 100th element in the list, L100
Step 4: Stop

The problem with these instructions is in Step 1, “Generate a list L of all


the prime numbers. . . .” That operation cannot be completed. There are an
infinite number of prime numbers, and it is not possible in a finite amount
of time to generate the desired list L. No such computational process exists,
and the operation described in Step 1 is not effectively computable. Here are
some other examples of operations that, under certain circumstances, may
not be effectively computable:
Set number to 0.
Set average to (sum 4 number). (Division by 0 is not permitted.)

Set N to 21.
Set the value of result to √ N. (You cannot take the square root of negative
values using real numbers.)

Add 1 to the current value of x. (What if x currently has no value?)


This last example explains why we had to initialize the value of the variable
called carry to 0 in Step 1 of Figure 1.2. In Step 4, the algorithm says, “Add the
two digits ai and bi to the current value of carry to get ci.” If carry has no current
value, then when the computing agent tries to perform the instruction in Step
4, it will not know what to do, and this operation is not effectively computable.
. . .that produces a result. . .
Algorithms solve problems. To know whether a solution is correct, an
algorithm must produce a result that is observable to a user, such as a
numerical answer, a new object, or a change to its environment. Without
some observable result, we would not be able to say whether the algorithm
is right or wrong or even if it has completed its computations. In the case of
the DVR algorithm (Figure 1.1), the result will be a set of recorded TV pro-
grams. The addition algorithm (Figure 1.2) produces an m-digit sum.
Note that we use the word result rather than answer. Sometimes it is not
possible for an algorithm to produce the correct answer because for a given
set of input, a correct answer does not exist. In those cases, the algorithm may
produce something else, such as an error message, a red warning light, or an
approximation to the correct answer. Error messages, lights, and approxima-
tions, although not necessarily what we wanted, are all observable results.
. . .and halts in a finite amount of time.

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
16 Chapter 1 An Introduction to Computer Science

Another important characteristic of algorithms is that the result must


be produced after the execution of a finite number of operations, and we
must guarantee that the algorithm eventually reaches a statement that says,
“Stop, you are done” or something equivalent. We have already pointed out
that the shampooing algorithm was not well ordered because we did not
know which statements to repeat in Step 4. However, even if we knew which
block of statements to repeat, the algorithm would still be incorrect because
it makes no provision to terminate. It will essentially run forever, or until we
run out of hot water, soap, or patience. This is called an infinite loop, and
it is a common error in the design of algorithms.
Figure 1.3 shows an algorithmic solution to the shampooing prob-
lem that meets all the criteria discussed in this section if we assume
that you want to wash your hair twice. The algorithm of Figure 1.3 is
well ordered. Each step is numbered, and the execution of the algorithm
unfolds sequentially, beginning at Step 1 and proceeding from instruc-
tion i to instruction i 1 1, unless the operation specifies otherwise. (For
example, the iterative instruction in Step 3 says that after completing
Step 6, you should go back and start again at Step 4 until the value of
WashCount equals 2.) The intent of each operation is (we assume) clear,
unambiguous, and doable by the person washing his or her hair. Finally,
the algorithm will halt. This is confirmed by observing that WashCount
is initially set to 0 in Step 2. Step 6 says to add 1 to WashCount each
time we lather and rinse our hair, so it will take on the values 0, 1, 2, . . .
However, the iterative statement in Step 3 says stop lathering and rinsing
when the value of WashCount reaches 2. At that point, the algorithm goes
to Step 7 and terminates execution with the desired result: clean hair.
(Although it is correct, do not expect to see this algorithm on the back of
a shampoo bottle in the near future.)
As is true for any recipe or set of instructions, there is always more
than a single way to write a correct solution. For example, the algorithm
of ­Figure 1.3 could also be written as shown in Figure 1.4. Both of these
are correct solutions to the shampooing problem. (Although they are both

FIGURE 1.3
Step Operation
1 Wet your hair
2 Set the value of WashCount to 0
3 Repeat Steps 4 through 6 until the value of WashCount equals 2
4 Lather your hair
5 Rinse your hair
6 Add 1 to the value of WashCount
7 Stop, you have finished shampooing your hair

A correct solution to the shampooing problem

Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter 1 An Introduction to Computer Science 17

FIGURE 1.4
Step Operation
1 Wet your hair
2 Lather your hair
3 Rinse your hair
4 Lather your hair
5 Rinse your hair
6 Stop, you have finished shampooing your hair

Another correct solution to the shampooing problem

correct, they are not necessarily equally elegant. This point is addressed in
Exercise 9 at the end of the chapter.)

1.3.2 The Importance of Algorithmic


Problem Solving
The instruction sequences in Figures 1.1–1.4 are examples of the types of
algorithmic solutions designed, analyzed, implemented, and tested by com-
puter scientists, although they are much shorter and simpler. The operations
shown in these figures could be encoded into some appropriate language
and given to a computing agent (such as a personal computer or a robot)
to execute. The device would mechanically follow these i­nstructions and
successfully complete the task. The device could do this without having
to understand the creative processes that went into the discovery of the
solution and without knowing the principles and concepts that underlie
the problem. The robot simply follows the steps in the specified order (a
required characteristic of algorithms), successfully completing each opera-
tion (another required characteristic), and ultimately producing the desired
result after a finite amount of time (also required).
Just as the Industrial Revolution of the nineteenth century allowed
machines to take over the drudgery of repetitive physical tasks, the “com-
puter revolution” of the twentieth and twenty-first centuries has enabled us to
implement algorithms that mechanize and automate the drudgery of repetitive
mental tasks, such as adding long columns of numbers, finding one specific
name or account number within a massive database, sorting student records by
course number, and retrieving hotel or airline reservations from a file contain-
ing millions of pieces of data. This mechanization process offers the prospect
of enormous increases in productivity. It also frees people to do those things
that humans do much better than ­computers, such as creating new ideas, set-
ting policy, doing high-level planning, and determining the significance of the
results produced by a computer. C ­ ertainly, these operations are a much more
effective use of that unique computing agent called the human brain.
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-202
Copyright 2019 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Another random document with
no related content on Scribd:
and hope and fortitude flow from his page into thy heart? Has he led
thee to nature because his own soul was too happy in beholding her
power and love? Or is his passion for the wilderness only the
sensibility of the sick, the exhibition of a talent which only shines
whilst you praise it; which has no root in the character, and can thus
minister to the vanity but not to the happiness of the possessor; and
which derives all its éclat from our conventional education, but would
not make itself intelligible to the wise man of another age or country?
The water we wash with never speaks of itself, nor does fire or wind
or tree. Neither does the noble natural man: he yields himself to your
occasion and use, but his act expresses a reference to universal
good.
Another element of the modern poetry akin to this subjective
tendency, or rather the direction of that same on the question of
resources, is the Feeling of the Infinite. Of the perception now fast
becoming a conscious fact,—that there is One Mind, and that all the
powers and privileges which lie in any, lie in all; that I as a man may
claim and appropriate whatever of true or fair or good or strong has
anywhere been exhibited; that Moses and Confucius, Montaigne and
Leibnitz are not so much individuals as they are parts of man and
parts of me, and my intelligence proves them my own,—literature is
far the best expression. It is true, this is not the only nor the obvious
lesson it teaches. A selfish commerce and government have caught
the eye and usurped the hand of the masses. It is not to be
contested that selfishness and the senses write the laws under
which we live, and that the street seems to be built and the men and
women in it moving, not in reference to pure and grand ends, but
rather to very short and sordid ones. Perhaps no considerable
minority, no one man, leads a quite clean and lofty life. What then?
We concede in sadness the fact. But we say that these low
customary ways are not all that survives in human beings. There is
that in us which mutters, and that which groans, and that which
triumphs, and that which aspires. There are facts on which men of
the world superciliously smile, which are worth all their trade and
politics; which drive young men into gardens and solitary places, and
cause extravagant gestures, starts, distortions of the countenance,
and passionate exclamations; sentiments, which find no aliment or
language for themselves on the wharves, in court, or market, but
which are soothed by silence, by darkness, by the pale stars, and
the presence of nature. All over the modern world the educated and
susceptible have betrayed their discontent with the limits of our
municipal life, and with the poverty of our dogmas of religion and
philosophy. They betray this impatience by fleeing for resource to a
conversation with nature, which is courted in a certain moody and
exploring spirit, as if they anticipated a more intimate union of man
with the world than has been known in recent ages. Those who
cannot tell what they desire or expect, still sigh and struggle with
indefinite thoughts and vast wishes. The very child in the nursery
prattles mysticism, and doubts and philosophizes. A wild striving to
express a more inward and infinite sense characterizes the works of
every art. The music of Beethoven is said, by those who understand
it, to labor with vaster conceptions and aspirations than music has
attempted before. This feeling of the Infinite has deeply colored the
poetry of the period. This new love of the vast, always native in
Germany, was imported into France by De Staël, appeared in
England in Coleridge, Wordsworth, Byron, Shelley, Felicia Hemans,
and finds a most genial climate in the American mind. Scott and
Crabbe, who formed themselves on the past, had none of this
tendency; their poetry is objective. In Byron, on the other hand, it
predominates; but in Byron it is blind, it sees not its true end—an
infinite good, alive and beautiful, a life nourished on absolute
beatitudes, descending into nature to behold itself reflected there.
His will is perverted, he worships the accidents of society, and his
praise of nature is thieving and selfish.
Nothing certifies the prevalence of this taste in the people more
than the circulation of the poems,—one would say most
incongruously united by some bookseller,—of Coleridge, Shelley and
Keats. The only unity is in the subjectiveness and the aspiration
common to the three writers. Shelley, though a poetic mind, is never
a poet. His muse is uniformly imitative; all his poems composite. A
good English scholar he is, with ear, taste, and memory; much more,
he is a character full of noble and prophetic traits; but imagination,
the original, authentic fire of the bard, he has not. He is clearly
modern, and shares with Richter, Chateaubriand, Manzoni and
Wordsworth, the feeling of the infinite, which so labors for expression
in their different genius. But all his lines are arbitrary, not necessary.
When we read poetry, the mind asks,—Was this verse one of twenty
which the author might have written as well; or is this what that man
was created to say? But, whilst every line of the true poet will be
genuine, he is in a boundless power and freedom to say a million
things. And the reason why he can say one thing well, is because his
vision extends to the sight of all things, and so he describes each as
one who knows many and all.
The fame of Wordsworth is a leading fact in modern literature,
when it is considered how hostile his genius at first seemed to the
reigning taste, and with what limited poetic talents his great and
steadily growing dominion has been established. More than any poet
his success has been not his own but that of the idea which he
shared with his coevals, and which he has rarely succeeded in
adequately expressing. The Excursion awakened in every lover of
Nature the right feeling. We saw stars shine, we felt the awe of
mountains, we heard the rustle of the wind in the grass, and knew
again the ineffable secret of solitude. It was a great joy. It was nearer
to Nature than anything we had before. But the interest of the poem
ended almost with the narrative of the influences of Nature on the
mind of the Boy, in the First Book. Obviously for that passage the
poem was written, and with the exception of this and of a few strains
of the like character in the sequel, the whole poem was dull. Here
was no poem, but here was poetry, and a sure index where the
subtle muse was about to pitch her tent and find the argument of her
song. It was the human soul in these last ages striving for a just
publication of itself. Add to this, however, the great praise of
Wordsworth, that more than any other contemporary bard he is
pervaded with a reverence of somewhat higher than (conscious)
thought. There is in him that property common to all great poets, a
wisdom of humanity, which is superior to any talents which they
exert. It is the wisest part of Shakspeare and of Milton. For they are
poets by the free course which they allow to the informing soul,
which through their eyes beholdeth again and blesseth the things
which it hath made. The soul is superior to its knowledge, wiser than
any of its works.
With the name of Wordsworth rises to our recollection the name of
his contemporary and friend, Walter Savage Landor—a man working
in a very different and peculiar spirit, yet one whose genius and
accomplishments deserve a wiser criticism than we have yet seen
applied to them, and the rather that his name does not readily
associate itself with any school of writers. Of Thomas Carlyle, also,
we shall say nothing at this time, since the quality and energy of his
influence on the youth of this country will require at our hands,
erelong, a distinct and faithful acknowledgment.
But of all men he who has united in himself, and that in the most
extraordinary degree, the tendencies of the era, is the German poet,
naturalist and philosopher, Goethe. Whatever the age inherited or
invented, he made his own. He has owed to Commerce and to the
victories of the Understanding, all their spoils. Such was his capacity,
that the magazines of the world’s ancient or modern wealth, which
arts and intercourse and skepticism could command,—he wanted
them all. Had there been twice so much, he could have used it as
well. Geologist, mechanic, merchant, chemist, king, radical, painter,
composer,—all worked for him, and a thousand men seemed to look
through his eyes. He learned as readily as other men breathe. Of all
the men of this time, not one has seemed so much at home in it as
he. He was not afraid to live. And in him this encyclopædia of facts,
which it has been the boast of the age to compile, wrought an equal
effect. He was knowing; he was brave; he was clean from all
narrowness; he has a perfect propriety and taste,—a quality by no
means common to the German writers. Nay, since the earth as we
said had become a reading-room, the new opportunities seem to
have aided him to be that resolute realist he is, and seconded his
sturdy determination to see things for what they are. To look at him
one would say there was never an observer before. What sagacity,
what industry of observation. To read his record is a frugality of time,
for you shall find no word that does not stand for a thing, and he is of
that comprehension which can see the value of truth. His love of
Nature has seemed to give a new meaning to that word. There was
never man more domesticated in this world than he. And he is an
apology for the analytic spirit of the period, because, of his analysis,
always wholes were the result. All conventions, all traditions he
rejected. And yet he felt his entire right and duty to stand before and
try and judge every fact in nature. He thought it necessary to dot
round with his own pen the entire sphere of knowables; and for many
of his stories, this seems the only reason: Here is a piece of
humanity I had hitherto omitted to sketch;—take this. He does not
say so in syllables,—yet a sort of conscientious feeling he had to be
up to the universe, is the best account and apology for many of
them. He shared also the subjectiveness of the age, and that too in
both the senses I have discriminated. With the sharpest eye for form,
color, botany, engraving, medals, persons and manners, he never
stopped at surface, but pierced the purpose of a thing and studied to
reconcile that purpose with his own being. What he could so
reconcile was good; what he could not, was false. Hence a certain
greatness encircles every fact he treats; for to him it has a soul, an
eternal reason why it was so, and not otherwise. This is the secret of
that deep realism, which went about among all objects he beheld, to
find the cause why they must be what they are. It was with him a
favorite task to find a theory of every institution, custom, art, work of
art, which he observed. Witness his explanation of the Italian mode
of reckoning the hours of the day, as growing out of the Italian
climate; of the obelisk of Egypt, as growing out of a common natural
fracture in the granite parallelopiped in Upper Egypt; of the Doric
architecture, and the Gothic; of the Venetian music of the gondolier,
originating in the habit of the fishers’ wives of the Lido singing on
shore to their husbands on the sea; of the amphitheatre, which is the
enclosure of the natural cup of heads that arranges itself round every
spectacle in the street; of the coloring of Titian and Paul Veronese,
which one may verify in common daylight in Venice every afternoon;
of the Carnival at Rome; of the domestic rural architecture in Italy;
and many the like examples.
But also that other vicious subjectiveness, that vice of the time,
infected him also. We are provoked with his Olympian self-
complacency, the patronizing air with which he vouchsafes to
tolerate the genius and performances of other mortals, “the good
Hiller,” “our excellent Kant,” “the friendly Wieland,” &c. &c. There is a
good letter from Wieland to Merck, in which Wieland relates that
Goethe read to a select party his journal of a tour in Switzerland with
the Grand Duke, and their passage through the Vallais and over the
St. Gothard. “It was,” says Wieland, “as good as Xenophon’s
Anabasis. The piece is one of his most masterly productions, and is
thought and written with the greatness peculiar to him. The fair
hearers were enthusiastic at the nature in this piece; I liked the sly
art in the composition, whereof they saw nothing, still better. It is a
true poem, so concealed is the art too. But what most remarkably in
this, as in all his other works, distinguishes him from Homer and
Shakspeare, is, that the Me, the Ille ego, everywhere glimmers
through, although without any boasting and with an infinite fineness.”
This subtle element of egotism in Goethe certainly does not seem to
deform his compositions, but to lower the moral influence of the man.
He differs from all the great in the total want of frankness. Who saw
Milton, who saw Shakspeare, saw them do their best, and utter their
whole heart manlike among their brethren. No man was permitted to
call Goethe brother. He hid himself, and worked always to astonish,
which is egotism, and therefore little.
If we try Goethe by the ordinary canons of criticism, we should say
that his thinking is of great altitude, and all level; not a succession of
summits, but a high Asiatic table-land. Dramatic power, the rarest
talent in literature, he has very little. He has an eye constant to the
fact of life and that never pauses in its advance. But the great
felicities, the miracles of poetry, he has never. It is all design with
him, just thought and instructed expression, analogies, allusion,
illustration, which knowledge and correct thinking supply; but of
Shakspeare and the transcendent muse, no syllable. Yet in the court
and law to which we ordinarily speak, and without adverting to
absolute standards, we claim for him the praise of truth, of fidelity to
his intellectual nature. He is the king of all scholars. In these days
and in this country, where the scholars are few and idle, where men
read easy books and sleep after dinner, it seems as if no book could
so safely be put in the hands of young men as the letters of Goethe,
which attest the incessant activity of this man, to eighty years, in an
endless variety of studies, with uniform cheerfulness and greatness
of mind. They cannot be read without shaming us into an emulating
industry. Let him have the praise of the love of truth. We think, when
we contemplate the stupendous glory of the world, that it were life
enough for one man merely to lift his hands and cry with St.
Augustine, “Wrangle who pleases, I will wonder.” Well, this he did.
Here was a man who, in the feeling that the thing itself was so
admirable as to leave all comment behind, went up and down, from
object to object, lifting the veil from every one, and did no more.
What he said of Lavater, may trulier be said of him, that “it was
fearful to stand in the presence of one before whom all the
boundaries within which Nature has circumscribed our being were
laid flat.” His are the bright and terrible eyes which meet the modern
student in every sacred chapel of thought, in every public enclosure.
But now, that we may not seem to dodge the question which all
men ask, nor pay a great man so ill a compliment as to praise him
only in the conventional and comparative speech, let us honestly
record our thought upon the total worth and influence of this genius.
Does he represent, not only the achievement of that age in which he
lived, but that which it would be and is now becoming? And what
shall we think of that absence of the moral sentiment, that singular
equivalence to him of good and evil in action, which discredit his
compositions to the pure? The spirit of his biography, of his poems,
of his tales, is identical, and we may here set down by way of
comment on his genius the impressions recently awakened in us by
the story of Wilhelm Meister.
All great men have written proudly, nor cared to explain. They
knew that the intelligent reader would come at last, and would thank
them. So did Dante, so did Machiavel. Goethe has done this in
Meister. We can fancy him saying to himself:—There are poets
enough of the Ideal; let me paint the Actual, as, after years of
dreams, it will still appear and reappear to wise men. That all shall
right itself in the long Morrow, I may well allow, and my novel may
wait for the same regeneration. The age, that can damn it as false
and falsifying, will see that it is deeply one with the genius and
history of all the centuries. I have given my characters a bias to error.
Men have the same. I have let mischance befall instead of good
fortune. They do so daily. And out of many vices and misfortunes, I
have let a great success grow, as I had known in my own and many
other examples. Fierce churchmen and effeminate aspirants will
chide and hate my name, but every keen beholder of life will justify
my truth, and will acquit me of prejudging the cause of humanity by
painting it with this morose fidelity. To a profound soul is not austere
truth the sweetest flattery?
Yes, O Goethe! but the ideal is truer than the actual. That is
ephemeral, but this changes not. Moreover, because nature is moral,
that mind only can see, in which the same order entirely obtains. An
interchangeable Truth, Beauty and Goodness, each wholly
interfused in the other, must make the humors of that eye which
would see causes reaching to their last effect and reproducing the
world forever. The least inequality of mixture, the excess of one
element over the other, in that degree diminishes the transparency of
things, makes the world opaque to the observer, and destroys so far
the value of his experience. No particular gifts can countervail this
defect. In reading Meister, I am charmed with the insight; to use a
phrase of Ben Jonson’s, “it is rammed with life.” I find there actual
men and women even too faithfully painted. I am moreover
instructed in the possibility of a highly accomplished society, and
taught to look for great talent and culture under a gray coat. But this
is all. The limits of artificial society are never quite out of sight. The
vicious conventions, which hem us in like prison walls and which the
poet should explode at his touch, stand for all they are worth in the
newspaper. We are never lifted above ourselves, we are not
transported out of the dominion of the senses, or cheered with an
infinite tenderness, or armed with a grand trust.
Goethe, then, must be set down as the poet of the Actual, not of
the Ideal; the poet of limitation, not of possibility; of this world, and
not of religion and hope; in short, if we may say so, the poet of
prose, and not of poetry. He accepts the base doctrine of Fate, and
gleans what straggling joys may yet remain out of its ban. He is like
a banker or a weaver with a passion for the country; he steals out of
the hot streets before sunrise, or after sunset, or on a rare holiday, to
get a draft of sweet air and a gaze at the magnificence of summer,
but dares not break from his slavery and lead a man’s life in a man’s
relation to nature. In that which should be his own place, he feels like
a truant, and is scourged back presently to his task and his cell.
Poetry is with Goethe thus external, the gilding of the chain, the
mitigation of his fate; but the Muse never assays those thunder-
tones which cause to vibrate the sun and the moon, which dissipate
by dreadful melody all this iron network of circumstance, and abolish
the old heavens and the old earth before the freewill or Godhead of
man. That Goethe had not a moral perception proportionate to his
other powers, is not then merely a circumstance, as we might relate
of a man that he had or had not the sense of tune or an eye for
colors, but it is the cardinal fact of health or disease; since, lacking
this, he failed in the high sense to be a creator, and, with divine
endowments, drops by irreversible decree into the common history
of genius. He was content to fall into the track of vulgar poets and
spend on common aims his splendid endowments, and has declined
the office proffered to now and then a man in many centuries in the
power of his genius, of a Redeemer of the human mind. He has
written better than other poets only as his talent was subtler, but the
ambition of creation he refused. Life for him is prettier, easier, wiser,
decenter, has a gem or two more on its robe, but its old eternal
burden is not relieved; no drop of healthier blood flows yet in its
veins. Let him pass. Humanity must wait for its physician still at the
side of the road, and confess as this man goes out, that they have
served it better who assured it out of the innocent hope in their
hearts that a Physician will come, than this majestic Artist, with all
the treasuries of wit, of science, and of power at his command.
The criticism, which is not so much spoken as felt in reference to
Goethe, instructs us directly in the hope of literature. We feel that a
man gifted like him should not leave the world as he found it. It is
true, though somewhat sad, that every fine genius teaches us how to
blame himself. Being so much, we cannot forgive him for not being
more. When one of these grand monads is incarnated whom nature
seems to design for eternal men and draw to her bosom, we think
that the old weariness of Europe and Asia, the trivial forms of daily
life will now end, and a new morning break on us all. What is
Austria? What is England? What is our graduated and petrified social
scale of ranks and employments? Shall not a poet redeem us from
these idolatries, and pale their legendary lustre before the fires of the
Divine Wisdom which burn in his heart? All that in our sovereign
moments each of us has divined of the powers of thought, all the
hints of omnipresence and energy which we have caught, this man
should unfold, and constitute facts.
And this is the insatiable craving which alternately saddens and
gladdens men at this day. The Doctrine of the Life of Man
established after the truth through all his faculties;—this is the
thought which the literature of this hour meditates and labors to say.
This is that which tunes the tongue and fires the eye and sits in the
silence of the youth. Verily it will not long want articulate and
melodious expression. There is nothing in the heart but comes
presently to the lips. The very depth of the sentiment, which is the
author of all the cutaneous life we see, is guarantee for the riches of
science and of song in the age to come. He who doubts whether this
age or this country can yield any contribution to the literature of the
world, only betrays his own blindness to the necessities of the
human soul. Has the power of poetry ceased, or the need? Have the
eyes ceased to see that which they would have, and which they
have not? Have they ceased to see other eyes? Are there no lonely,
anxious, wondering children, who must tell their tale? Are we not
evermore whipped by thoughts;
“In sorrow steeped, and steeped in love
Of thoughts not yet incarnated.”
The heart beats in this age as of old, and the passions are busy as
ever. Nature has not lost one ringlet of her beauty, one impulse of
resistance and valor. From the necessity of loving none are exempt,
and he that loves must utter his desires. A charm as radiant as
beauty ever beamed, a love that fainteth at the sight of its object, is
new to-day.
“The world does not run smoother than of old,
There are sad haps that must be told.”
Man is not so far lost but that he suffers ever the great Discontent
which is the elegy of his loss and the prediction of his recovery. In
the gay saloon he laments that these figures are not what Raphael
and Guercino painted. Withered though he stand, and trifler though
he be, the august spirit of the world looks out from his eyes. In his
heart he knows the ache of spiritual pain, and his thought can
animate the sea and land. What then shall hinder the Genius of the
time from speaking its thought? It cannot be silent, if it would. It will
write in a higher spirit and a wider knowledge and with a grander
practical aim than ever yet guided the pen of poet. It will write the
annals of a changed world, and record the descent of principles into
practice, of love into Government, of love into Trade. It will describe
the new heroic life of man, the now unbelieved possibility of simple
living and of clean and noble relations with men. Religion will bind
again these that were sometime frivolous, customary, enemies,
skeptics, self-seekers, into a joyful reverence for the circumambient
Whole, and that which was ecstacy shall become daily bread.

II.

WALTER SAVAGE LANDOR. [6]

We sometimes meet in a stage coach in New England an erect,


muscular man, with fresh complexion and a smooth hat, whose
nervous speech instantly betrays the English traveller;—a man
nowise cautious to conceal his name or that of his native country, or
his very slight esteem for the persons and the country that surround
him. When Mr. Bull rides in an American coach, he speaks quick and
strong; he is very ready to confess his ignorance of everything about
him, persons, manners, customs, politics, geography. He wonders
that the Americans should build with wood, whilst all this stone is
lying in the roadside; and is astonished to learn that a wooden house
may last a hundred years; nor will he remember the fact as many
minutes after it has been told him: he wonders that they do not make
elder-wine and cherry-bounce, since here are cherries, and every
mile is crammed with elder-bushes. He has never seen a good horse
in America, nor a good coach, nor a good inn. Here is very good
earth and water and plenty of them; that he is free to allow; to all
other gifts of nature or man his eyes are sealed by the inexorable
demand for the precise conveniences to which he is accustomed in
England. Add to this proud blindness the better quality of great
downrightness in speaking the truth, and the love of fair play, on all
occasions, and moreover the peculiarity which is alleged of the
Englishman, that his virtues do not come out until he quarrels.
Transfer these traits to a very elegant and accomplished mind, and
we shall have no bad picture of Walter Savage Landor, who may
stand as a favorable impersonation of the genius of his countrymen
at the present day. A sharp, dogmatic man, with a great deal of
knowledge, a great deal of worth, and a great deal of pride; with a
profound contempt for all that he does not understand; a master of
all elegant learning, and capable of the utmost delicacy of sentiment,
and yet prone to indulge a sort of ostentation of coarse imagery and
language. His partialities and dislikes are by no means culpable, but
are often whimsical and amusing; yet they are quite sincere, and,
like those of Johnson and Coleridge, are easily separable from the
man. What he says of Wordsworth is true of himself, that he delights
to throw a clod of dirt on the table, and cry “Gentlemen, there is a
better man than all of you.” Bolivar, Mina and General Jackson will
never be greater soldiers than Napoleon and Alexander, let Mr.
Landor think as he will; nor will he persuade us to burn Plato and
Xenophon, out of our admiration of Bishop Patrick, or “Lucas on
Happiness,” or “Lucas on Holiness,” or even Barrow’s Sermons. Yet
a man may love a paradox without either losing his wit or his
honesty. A less pardonable eccentricity is the cold and gratuitous
obtrusion of licentious images, not so much the suggestion of
merriment as of bitterness. Montaigne assigns as a reason for his
license of speech, that he is tired of seeing his Essays on the work-
tables of ladies, and he is determined they shall for the future put
them out of sight. In Mr. Landor’s coarseness there is a certain air of
defiance, and the rude word seems sometimes to arise from a
disgust at niceness and over-refinement. Before a well-dressed
company he plunges his fingers in a cesspool, as if to expose the
whiteness of his hands and the jewels of his ring. Afterward, he
washes them in water, he washes them in wine; but you are never
secure from his freaks. A sort of Earl Peterborough in literature, his
eccentricity is too decided not to have diminished his greatness. He
has capital enough to have furnished the brain of fifty stock authors,
yet has written no book.
But we have spoken all our discontent. Possibly his writings are
open to harsher censure; but we love the man, from sympathy as
well as for reasons to be assigned; and have no wish, if we were
able, to put an argument in the mouth of his critics. Now for twenty
years we have still found the “Imaginary Conversations” a sure
resource in solitude, and it seems to us as original in its form as in its
matter. Nay, when we remember his rich and ample page, wherein
we are always sure to find free and sustained thought, a keen and
precise understanding, an affluent and ready memory familiar with all
chosen books, an industrious observation in every department of life,
an experience to which nothing has occurred in vain, honor for every
just and generous sentiment and a scourge like that of Furies for
every oppressor, whether public or private,—we feel how dignified is
this perpetual Censor in his curule chair, and we wish to thank a
benefactor of the reading world.
Mr. Landor is one of the foremost of that small class who make
good in the nineteenth century the claims of pure literature. In these
busy days of avarice and ambition, when there is so little disposition
to profound thought or to any but the most superficial intellectual
entertainments, a faithful scholar, receiving from past ages the
treasures of wit and enlarging them by his own love, is a friend and
consoler of mankind. When we pronounce the names of Homer and
Æschylus; Horace, Ovid and Plutarch; Erasmus, Scaliger and
Montaigne; Ben Jonson and Isaak Walton; Dryden and Pope,—we
pass at once out of trivial associations and enter into a region of the
purest pleasure accessible to human nature. We have quitted all
beneath the moon and entered that crystal sphere in which
everything in the world of matter reappears, but transfigured and
immortal. Literature is the effort of man to indemnify himself for the
wrongs of his condition. The existence of the poorest play-wright and
the humblest scrivener is a good omen. A charm attaches to the
most inferior names which have in any manner got themselves
enrolled in the registers of the House of Fame, even as porters and
grooms in the courts; to Creech and Fenton, Theobald and Dennis,
Aubrey and Spence. From the moment of entering a library and
opening a desired book, we cease to be citizens, creditors, debtors,
housekeepers and men of care and fear. What boundless leisure!
what original jurisdiction! the old constellations have set, new and
brighter have arisen; an Elysian light tinges all objects:—
“In the afternoon we came unto a land
In which it seemed always afternoon.”
And this sweet asylum of an intellectual life must appear to have
the sanction of nature, as long as so many men are born with so
decided an aptitude for reading and writing. Let us thankfully allow
every faculty and art which opens new scope to a life so confined as
ours. There are vast spaces in a thought: a slave, to whom the
religious sentiment is opened, has a freedom which makes his
master’s freedom a slavery. Let us not be so illiberal with our
schemes for the renovation of society and nature as to disesteem or
deny the literary spirit. Certainly there are heights in nature which
command this; there are many more which this commands. It is vain
to call it a luxury, and as saints and reformers are apt to do, decry it
as a species of day-dreaming. What else are sanctities, and reforms,
and all other things? Whatever can make for itself an element,
means, organs, servants, and the most profound and permanent
existence in the hearts and heads of millions of men, must have a
reason for its being. Its excellency is reason and vindication enough.
If rhyme rejoices us there should be rhyme, as much as if fire cheers
us we should bring wood and coals. Each kind of excellence takes
place for its hour and excludes everything else. Do not brag of your
actions, as if they were better than Homer’s verses or Raphael’s
pictures. Raphael and Homer feel that action is pitiful beside their
enchantments. They could act too, if the stake was worthy of them:
but now all that is good in the universe urges them to their task.
Whoever writes for the love of truth and beauty, and not with ulterior
ends, belongs to this sacred class; and among these, few men of the
present age have a better claim to be numbered than Mr. Landor.
Wherever genius or taste has existed, wherever freedom and justice
are threatened, which he values as the element in which genius may
work, his interest is sure to be commanded. His love of beauty is
passionate, and betrays itself in all petulant and contemptuous
expressions.
But beyond his delight in genius and his love of individual and civil
liberty, Mr. Landor has a perception that is much more rare, the
appreciation of character. This is the more remarkable considered
with his intense nationality, to which we have already alluded. He is
buttoned in English broadcloth to the chin. He hates the Austrians,
the Italians, the French, the Scotch, and the Irish. He has the
common prejudices of an English landholder; values his pedigree,
his acres and the syllables of his name; loves all his advantages, is
not insensible to the beauty of his watch seal, or the Turk’s head on
his umbrella; yet with all this miscellaneous pride there is a noble
nature within him which instructs him that he is so rich that he can
well spare all his trappings, and, leaving to others the painting of
circumstance, aspire to the office of delineating character. He draws
his own portrait in the costume of a village schoolmaster, and a
sailor, and serenely enjoys the victory of nature over fortune. Not
only the elaborated story of Normanby, but the whimsical selection of
his heads proves this taste. He draws with evident pleasure the
portrait of a man who never said anything right and never did
anything wrong. But in the character of Pericles he has found full
play for beauty and greatness of behavior, where the circumstances
are in harmony with the man. These portraits, though mere sketches,
must be valued as attempts in the very highest kind of narrative,
which not only has very few examples to exhibit of any success, but
very few competitors in the attempt. The word Character is in all
mouths; it is a force which we all feel; yet who has analyzed it? What
is the nature of that subtle and majestic principle which attaches us
to a few persons, not so much by personal as by the most spiritual
ties? What is the quality of the persons who, without being public
men, or literary men, or rich men, or active men, or (in the popular
sense) religious men, have a certain salutary omnipresence in all our
life’s history, almost giving their own quality to the atmosphere and
the landscape? A moral force, yet wholly unmindful of creed and
catechism, intellectual, but scornful of books, it works directly and
without means, and though it may be resisted at any time, yet
resistance to it is a suicide. For the person who stands in this lofty
relation to his fellow-men is always the impersonation to them of
their conscience. It is a sufficient proof of the extreme delicacy of this
element, evanescing before any but the most sympathetic vision,
that it has so seldom been employed in the drama and in novels. Mr.
Landor, almost alone among living English writers, has indicated his
perception of it.
These merits make Mr. Landor’s position in the republic of letters
one of great mark and dignity. He exercises with a grandeur of spirit
the office of writer, and carries it with an air of old and
unquestionable nobility. We do not recollect an example of more
complete independence in literary history. He has no clanship, no
friendships that warp him. He was one of the first to pronounce
Wordsworth the great poet of the age, yet he discriminates his faults
with the greater freedom. He loves Pindar, Æschylus, Euripides,
Aristophanes, Demosthenes, Virgil, yet with open eyes. His position
is by no means the highest in literature: he is not a poet or a
philosopher. He is a man full of thoughts, but not, like Coleridge, a
man of ideas. Only from a mind conversant with the First Philosophy
can definitions be expected. Coleridge has contributed many
valuable ones to modern literature. Mr. Landor’s definitions are only
enumerations of particulars; the generic law is not seized. But as it is
not from the highest Alps or Andes but from less elevated summits
that the most attractive landscape is commanded, so is Mr. Landor
the most useful and agreeable of critics. He has commented on a
wide variety of writers, with a closeness and extent of view which
has enhanced the value of those authors to his readers. His
Dialogue on the Epicurean philosophy is a theory of the genius of
Epicurus. The Dialogue between Barrow and Newton is the best of
all criticisms on the essays of Bacon. His picture of Demosthenes in
three several Dialogues is new and adequate. He has illustrated the
genius of Homer, Æschylus, Pindar, Euripides, Thucydides. Then he
has examined before he has expatiated, and the minuteness of his
verbal criticism gives a confidence in his fidelity when he speaks the
language of meditation or of passion. His acquaintance with the
English tongue is unsurpassed. He “hates false words, and seeks
with care, difficulty and moroseness those that fit the thing.” He
knows the value of his own words. “They are not,” he says, “written
on slate.” He never stoops to explanation, nor uses seven words
where one will do. He is a master of condensation and suppression,
and that in no vulgar way. He knows the wide difference between
compression and an obscure elliptical style. The dense writer has yet
ample room and choice of phrase, and even a gamesome mood
often between his valid words. There is no inadequacy or
disagreeable contraction in his sentence, any more than in a human
face, where in a square space of a few inches is found room for
every possible variety of expression.
Yet it is not as an artist that Mr. Landor commends himself to us.
He is not epic or dramatic, he has not the high, overpowering
method by which the master gives unity and integrity to a work of
many parts. He is too wilful, and never abandons himself to his
genius. His books are a strange mixture of politics, etymology,
allegory, sentiment, and personal history; and what skill of transition
he may possess is superficial, not spiritual. His merit must rest, at
last, not on the spirit of the dialogue or the symmetry of any of his
historical portraits, but on the value of his sentences. Many of these
will secure their own immortality in English literature; and this, rightly
considered, is no mean merit. These are not plants and animals, but
the genetical atoms of which both are composed. All our great debt
to the Oriental world is of this kind, not utensils and statues of the
precious metal, but bullion and gold-dust. Of many of Mr. Landor’s
sentences we are fain to remember what was said of those of
Socrates; that they are cubes, which will stand firm, place them how
or where you will.

III.

PRAYERS. [7]

“Not with fond shekels of the tested gold,


Nor gems whose rates are either rich or poor
As fancy values them: but with true prayers,
That shall be up at heaven and enter there
Ere sunrise; prayers from preserved souls,
From fasting maids, whose minds are dedicate
To nothing temporal.”
Shakspeare.
Pythagoras said that the time when men are honestest is when
they present themselves before the gods. If we can overhear the
prayer we shall know the man. But prayers are not made to be
overheard, or to be printed, so that we seldom have the prayer
otherwise than it can be inferred from the man and his fortunes,
which are the answer to the prayer, and always accord with it. Yet
there are scattered about in the earth a few records of these devout
hours, which it would edify us to read, could they be collected in a
more catholic spirit than the wretched and repulsive volumes which
usurp that name. Let us not have the prayers of one sect, nor of the
Christian Church, but of men in all ages and religions who have
prayed well. The prayer of Jesus is (as it deserves) become a form
for the human race. Many men have contributed a single expression,
a single word to the language of devotion, which is immediately
caught and stereotyped in the prayers of their church and nation.
Among the remains of Euripides we have this prayer: “Thou God of
all! infuse light into the souls of men, whereby they may be enabled
to know what is the root from whence all their evils spring, and by
what means they may avoid them.” In the Phædrus of Plato, we find
this petition in the mouth of Socrates: “O gracious Pan! and ye other
gods who preside over this place! grant that I may be beautiful
within; and that those external things which I have may be such as
may best agree with a right internal disposition of mine; and that I
may account him to be rich, who is wise and just.” Wacic the Caliph,
who died a. d. 845, ended his life, the Arabian historians tell us, with
these words: “O thou whose kingdom never passes away, pity one
whose dignity is so transient.” But what led us to these
remembrances was the happy accident which in this undevout age
lately brought us acquainted with two or three diaries, which attest, if
there be need of attestation, the eternity of the sentiment and its
equality to itself through all the variety of expression. The first is the
prayer of a deaf and dumb boy:—
“When my long-attached friend comes to me, I have
pleasure to converse with him, and I rejoice to pass my
eyes over his countenance; but soon I am weary of
spending my time causelessly and unimproved, and I
desire to leave him, (but not in rudeness), because I
wished to be engaged in my business. But thou, O my
Father, knowest I always delight to commune with thee in
my lone and silent heart; I am never full of thee; I am
never weary of thee; I am always desiring thee. I hunger
with strong hope and affection for thee, and I thirst for thy
grace and spirit.
“When I go to visit my friends, I must put on my best
garments, and I must think of my manner to please them. I
am tired to stay long, because my mind is not free, and
they sometimes talk gossip with me. But oh, my Father,
thou visitest me in my work, and I can lift up my desires to
thee, and my heart is cheered and at rest with thy
presence, and I am always alone with thee, and thou dost
not steal my time by foolishness. I always ask in my heart,
where can I find thee?”

The next is a voice out of a solitude as strict and sacred as that in


which nature had isolated this eloquent mute:—
“My Father, when I cannot be cheerful or happy, I can
be true and obedient, and I will not forget that joy has
been, and may still be. If there is no hour of solitude
granted me, still I will commune with thee. If I may not
search out and pierce thy thought, so much the more may
my living praise thee. At whatever price, I must be alone
with thee; this must be the demand I make. These duties
are not the life, but the means which enable us to show
forth the life. So must I take up this cross, and bear it
willingly. Why should I feel reproved when a busy one
enters the room? I am not idle, though I sit with folded
hands, but instantly I must seek some cover. For that
shame I reprove myself. Are they only the valuable
members of society who labor to dress and feed it? Shall
we never ask the aim of all this hurry and foam, of this
aimless activity? Let the purpose for which I live be always
before me; let every thought and word go to confirm and
illuminate that end; namely, that I must become near and
dear to thee; that now I am beyond the reach of all but
thee.
“How can we not be reconciled to thy will? I will know
the joy of giving to my friend the dearest treasure I have. I
know that sorrow comes not at once only. We cannot meet
it and say, now it is overcome, but again, and yet again, its
flood pours over us, and as full as at first.
“If but this tedious battle could be fought,
Like Sparta’s heroes at one rocky pass,
‘One day be spent in dying,’ men had sought
The spot, and been cut down like mower’s grass.”
The next is in a metrical form. It is the aspiration of a different
mind, in quite other regions of power and duty, yet they all accord at
last.

“Great God, I ask thee for no meaner pelf


Than that I may not disappoint myself,
That in my action I may soar as high,
As I can now discern with this clear eye.

“And next in value, which thy kindness lends,


That I may greatly disappoint my friends,
Howe’er they think or hope that it may be,
They may not dream how thou’st distinguished me.

“That my weak hand may equal my firm faith,


And my life practise more than my tongue saith;
That my low conduct may not show,
Nor my relenting lines,
That I thy purpose did not know,

You might also like