1. Trang chủ
  2. » Khoa Học Tự Nhiên

Algorithms and data structures the science of computing do

1,1K 172 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1.064
Dung lượng 6,41 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Scragg Charles River Media © 2004 640 pagesISBN:1584502509 By focusing on the architecture of algorithms, mathematical modeling and analysis, and experimental confirmation of theoretical

Trang 1

Algorithms and Data Structures:

The Science of Computing

by Douglas Baldwin and Greg W Scragg Charles River Media ©

2004 (640 pages)ISBN:1584502509

By focusing on the architecture of algorithms, mathematical modeling and analysis, and experimental confirmation of theoretical results, this book helps students see computer science is about

problem solving, not simply memorizing and reciting

Trang 2

Part I - The Science of Computing's Three Methods of Inquiry

Trang 3

List of Listings, Theorems and Lemmas List of Sidebars

Trang 4

Algorithms and Data Structures: The Science of Computing

by Douglas Baldwin and Greg W Scragg Charles River Media © 2004 (640 pages)

ISBN:1584502509

By focusing on the architecture of algorithms, mathematical modeling and analysis, and

experimental confirmation of theoretical results, this book helps students see computer science is about problem solving, not simply memorizing and reciting languages.

students can see explicitly how they interact Recursion and object oriented programming are emphasized as the main control structure and abstraction mechanism,

Trang 5

Features:

Reflects the principle that computer science is not solely about learning how to speak in a

University, he has taught courses from CS1 to

Compiler Construction, and from Networking to Theory

of Programming Languages He has authored many journal articles and conference papers within the field.

Greg W Scragg is Professor Emeritus from SUNY

Geneseo with over thirty years experience in computer science Since his graduation from the University of California, he has received several grants related to computer science education and has written over 60 articles for computer science journals.

Trang 7

Algorithms and Data Structures—The Science of Computing

Trang 9

The Science of Computing represents the culmination of a project that

has been in development for a very long time In the course of the

project, a great many people and organizations have contributed in manyways While it is impossible to list them all, we do wish to mention somewhose contributions have been especially important The research intothe methodology was supported by both the National Science Foundationand the U S Department of Education, and we are grateful for their

support During the first several years of the project, Hans Koomen was aco-investigator who played a central role in the developmental work Wereceived valuable feedback in the form of reviews from many includingJohn Hamer, Peter Henderson, Lew Hitchner, Kris Powers, Orit Hazzan,Mark LeBlanc, Allen Tucker, Tony Ralston, Daniel Hyde, Stuart Hirshfield,Tim Gegg-Harrison, Nicholas Howe, Catherine McGeoch, and Ken

Slonneger G Michael Schneider and Jim Leisy were also particularlyencouraging of our efforts Homma Farian, Indu Talwar, and Nancy Jonesall used drafts of the text in their courses, helping with that crucial firstexposure We held a series of workshops at SUNY Geneseo at whichsome of the ideas were fleshed out Faculty from other institutions whoattended and contributed their ideas include Elizabeth Adams, Hans-Peter Appelt, Lois Brady, Marcus Brown, John Cross, Nira Herrmann,Margaret I wobi, Margaret Reek, Ethel Schuster, James Slack, and

Fengman Zhang Almost 1500 students served as the front line soldiers

—the ones who contributed as the guinea pigs of our efforts—but weespecially wish to thank Suzanne Selib, Jim Durbin, Bruce Cowley, ErnieJohnson, Coralie Ashworth, Kevin Kosieracki, Greg Arnold, Steve

Batovsky, Wendy Abbott, Lisa Ciferri, Nandini Mehta, Steve Bender, MaryJohansen, Peter Denecke, Jason Kapusta, Michael Stringer, Jesse

Smith, Garrett Briggs, Elena Kornienko, and Genevieve Herres, all ofwhom worked directly with us on stages of the project Finally, we couldnot have completed this project without the staff of Charles River Media,especially Stephen Mossberg, David Pallai, and Bryan Davidson

Trang 11

methods.

Trang 12

The programming language for examples and exercises in this book isJava We assume that students have had an introductory programmingcourse using an object-oriented language, although not necessarily Java.The book should also be accessible with just a little extra work to thosewho started with a procedural language An appendix helps studentswhose previous experience is with a language other than Java make thetransition to Java

There is quite a bit of math in The Science of Computing We teach all of

the essential mathematics within the text, assuming only that readershave a good precollege math background However, readers who havecompleted one or more college-level math courses, particularly in

discrete math, will inevitably have an easier time with the math in thisbook than readers without such a background

Trang 13

Want to closely align their programs with other math and/orscience programs

Trang 15

depth study of the basic foundations of the field The appropriate

Trang 16

The rigorous notion of "experiment" used in the sciences

Techniques for collecting and analyzing data on the executiontime of programs or parts of programs

Advances in computer science depend on all three of these methods ofinquiry; therefore, a well-educated computer scientist must becomefamiliar with each—starting early in his education

Trang 18

construction of recursive algorithms (e g., search, insertion, deletion, andtraversal), mathematical analysis of data structures and their algorithms,and experiments that drive home the meaning of mathematical results (e.g., how nearly indistinguishable "logarithmic" time is from

"instantaneous"); however, we do not try to cover multiway trees, AVLtrees, B trees, redblack trees, and other variations on trees that appear inmany CS 2 texts

The Science of Computing's emphasis on methods of inquiry rather than

programming does have implications for subsequent courses Studentsmay enter those courses with a slightly narrower exposure to data

structures than is traditional, and programs that want CS 2 to provide afoundation in software engineering for later courses will find that there is

Software Engineering

Some new versions of CS 2 move the focus from data structures to

Trang 19

a solid foundation for later study of software engineering, but softwareengineering per se is not a major factor in this book

Data Structures

In spite of the coverage in Part III, The Science of Computing is not adata structures book A traditional data structures course could easily use

Trang 21

national and international trends well, and is appropriate for most CS 2courses

Our central themes align closely with many of the goals in the ACM/IEEEComputing Curricula 2001 report, for instance:[1]

An introductory sequence that exposes students to the

"conceptual foundations" of computer science, including the

"modes of thought and mental disciplines" computer scientistsuse to solve problems

Introducing discrete math early, and applying it throughout thecurriculum

An introductory sequence that includes reasoning about andexperimentally measuring algorithms' use of time and other

resources

A curriculum in which students "have direct hands-on experiencewith hypothesis formulation, experimental design, hypothesistesting, and data analysis "

An early introduction to recursion

Trang 24

This book has a number of other features that the student and instructorshould consider

Abstract vs Concrete

Abstraction as a problem-solving and design technique is an important

concept in The Science of Computing Object-oriented programming is a

nearly ideal form in which to discuss such abstraction Early in the book,students use object-oriented abstraction by designing and analyzing

algorithms whose primitives are really messages to objects This

abstraction enables short algorithms that embody one important ideaapiece to nonetheless solve interesting problems Class libraries let

students code the algorithms in working programs, demonstrating thatthe objects are "real" even if students don't know how they are

implemented For instance, many of the early examples of algorithms usemessages to a hypothetical robot to perform certain tasks; students cancode and run these algorithms "for real" using a software library that

provides an animated simulation of the robot Later, students learn tocreate their own object-oriented abstractions as they design new classeswhose methods encapsulate various algorithms

Trang 25

fundamental methods from language details, helping students

understand that the fundamentals are always relevant, and independent

of language Students realize that there is much to learn about the

fundamentals themselves, apart from simply how to write something in aparticular language

be explicitly addressed at all

Integration

Design, theory, and empirical analysis are not independent methods, butrather mutually supporting ideas Students should therefore learn aboutthem in an integrated manner, seeing explicitly how the methods interact.This approach helps students understand how all three methods arerelevant to their particular interests in computer science Unfortunately,the traditional introductory sequence artificially compartmentalizes

methods by placing them in separate courses (e.g., program design in

CS 1 and 2, but correctness and performance analysis in an analysis ofalgorithms course)

Active Learning

We believe that students should actively engage computers as they

learn Reading is only a prelude to personally solving problems, writingprograms, deriving and solving equations, conducting experiments, etc.Active engagement is particularly valuable in making a course such as

Trang 26

analysis), etc

Trang 28

The central theme of Part II: Program Design is indeed the design of

programs It reviews standard control structures, but treats each as adesign tool for solving certain kinds of problems, with mathematical

techniques for reasoning about its correctness and performance, andexperimental techniques for confirming the mathematical results

Recursion and related mathematics (induction and recurrence relations)are the heart of this part of the book

Armed with these tools, students are ready for Part III: Data Structures

(the central topic of many CS 2 texts) The tools related to algorithm

analysis and to recursion, specifically, can be applied directly to the

development of recursively defined data structures, including trees, lists,stacks, queues, hash tables, and priority queues We present these

structures in a manner that continues the themes of Parts I and II: lists as

an example of how ideas of repetition and recursion (and related analytictechniques) can be applied to structuring data just as they structuredcontrol; stacks and queues as adaptations of the list structure to specialapplications; trees as structures that improve theoretical and empiricalperformance; and hash tables and priority queues as case studies ingeneralizing the previous ideas and applying them to new problems.Finally, Part IV: The Limits of Computer Science takes students through

Trang 29

recognition that faster computers will not solve all problems

Course Structures for this Book

Depending on the focus of your curriculum, there are several ways to usethis text in a course

This book has evolved hand-in-hand with the introductory computer

science sequence at SUNY Geneseo There, the book is used for themiddle course in a three-course sequence, with the primary goal beingfor students to make the transition from narrow programming proficiency(the topic of the first course) to broader ability in all of computer science'smethods of inquiry In doing this, we concentrate heavily on:

Chapters 1–7, for the basic methods of inquiry

Chapters 11–13, as case studies in applying the methods and anintroduction to data structures

Chapters 16 and 17, for a preview of what the methods can

accomplish in more advanced computer science

This course leaves material on iteration (Chapters 8 and 9) and sorting(Chapter 10) for later courses to cover, and splits coverage of data

structures between the second and third courses in the introductory

sequence

An alternative course structure that accomplishes the same goal, but with

a perhaps more coherent focus on methods of inquiry in one course anddata structures in another could focus on:

Chapters 1–9, for the basic methods of inquiry

Chapter 10, for case studies in applying the methods and

coverage of sorting

Chapters 16 and 17, for a preview of what the methods can

Trang 30

Be aware, however, that the traditional data structures course outline

short-changes much of what we feel makes The Science of Computing

special Within the outline, students should at least be introduced to theideas in Chapters 1–3 in order to understand the context within which thelater chapters work, and as noted earlier, instructors may want to addmaterial on data structures beyond what this text covers

Trang 32

The Science of Computing Web site,

http://www.charlesriver.com/algorithms

includes much material useful to both instructors and students, includingJava code libraries to support the text examples, material to supportexperiments, sample lab exercises and other projects, expository

material for central ideas and alternative examples

Trang 34

Part I: The Science of Computing's Three Methods of Inquiry

Trang 35

study of computing, in other words, the study of processes for

mechanically solving problems The phrase "science of computing"

emphasizes this concern with general computing processes instead ofwith machines.[1]

The first four chapters of this book explain the idea of "processes" thatsolve problems and introduce the methods of inquiry with which computerscientists study those processes These methods of inquiry include

designing the processes, mathematically modeling how the processesshould behave, and experimentally verifying that the processes behave inpractice as they should in theory

[1]In fact, many parts of the world outside the United States call the field

"informatics," because it is more concerned with information and

information processing than with machines

Trang 38

Chapter 1: What is the Science of Computing?

Computer science is the study of processes for mechanically solvingproblems It may surprise you to learn that there truly is a science ofcomputing—that there are fundamental rules that describe all computing,regardless of the machine or person doing it, and that these rules can bediscovered and tested through scientific theories and experiments Butthere is such a science, and this book introduces you to some of its rulesand the methods by which they are discovered and studied

This chapter describes more thoroughly the idea of processes that solve

problems, and surveys methods for scientifically studying such

processes

Trang 39

COMPUTING

Loosely speaking, processes for solving problems are called algorithms.

Algorithms, in a myriad of forms, are therefore the primary subject ofstudy in computer science Before we can say very much about

algorithms, however, we need to say something about the problems theysolve

1.1.1 Problems

Some people (including one of the authors) chill bottles or cans of softdrinks or fruit juice by putting them in a freezer for a short while beforedrinking them This is a nice way to get an extra-cold drink, but it risksdisaster: a drink left too long in the freezer begins to freeze, at whichpoint it starts to expand, ultimately bursting its container and spilling

whatever liquid isn't already frozen all over the freezer People who chilldrinks in freezers may thus be interested in knowing the longest time thatthey can safely leave a drink in the freezer, in other words, the time thatgives them the coldest drink with no mess to clean up afterwards Butsince neither drinks nor freezers come with the longest safe chilling timesstamped on them by the manufacturer, people face the problem of findingthose times for themselves This problem makes an excellent example ofthe kinds of problems and problem solving that exist in computer science

second less than planned is unlikely to change it from unacceptably

warm to messily frozen But the exact margin of error varies from one

Trang 40

to risk freezing it) Different instances of the longest safe chilling timeproblem are therefore distinguished by how powerful the freezer is, thesize of the drink, and what margin of error the drinker will accept Things

that distinguish one problem instance from another are called parameters

or inputs to the problem Also note that different instances of a problem

generally have different answers For example, the longest safe chillingtime for a two-liter bottle in a kitchenette freezer is different from the

longest safe chilling time for a half-liter in an commercial deep freeze It istherefore important to distinguish between an answer to a single instance

of a problem and a process that can solve any instance of the problem It

is far more useful to know a process with which to solve a problem

whenever it arises than to know the answer to only one instance—as anold proverb puts it, "Give a man a fish and you feed him dinner, but teachhim to fish and you feed him for life."

The second important feature of any computer science problem is thatyou can tell whether a potential answer is right or not For example, ifsomeone tells you that a particular drink can be chilled in a particularfreezer for up to 17 minutes, you can easily find out if this is right Chillthe drink for 17 minutes and see if it comes out not quite frozen; then chill

a similar container of the same drink for 17 minutes plus the margin oferror and see if it starts to freeze Put another way, a time must meetcertain requirements in order to solve a given instance of the problem,and it is possible to say exactly what those requirements are: the drink inquestion, chilled for that time in the freezer in question, shouldn't quitefreeze, whereas the drink in question, chilled for that time plus the margin

of error in the freezer in question, would start to freeze That you need toknow what constitutes a correct answer seems like a trivial point, but itbears an important moral nonetheless: before trying to find a process tosolve a problem, make sure you understand exactly what answers youwill accept

Not every problem has these two features Problems that lack one or theother are generally outside the scope of computer science For example,consider the problem, "In what year did people first walk on the moon?"This problem lacks the first feature of being likely to appear in many

Ngày đăng: 25/03/2019, 16:43

TỪ KHÓA LIÊN QUAN