1. Trang chủ
  2. » Giáo án - Bài giảng

CS1020E prentice hall data abstraction 6th edition nov 2012 ISBN 0132923726

838 61 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 838
Dung lượng 6,38 MB

Nội dung

C++ Reserved Keywords C++ reserves and gives predefined meanings to the following keywords You may not redefine keywords or use them for other purposes Keywords that appear in color are new since C++11 alignas decitype namespace struct alignof default new switch and delete noexcept template and_eq not this asm double not_eq thread_local auto dynamic_cast nullptr throw bitand else operator true bitor enum or try bool explicit or_eq typedef break export private typeid case extern protected typename catch false public union char float register unsigned char16_t for reinterpret_cast using char32_t friend return virtual class goto short void compl if signed volatile const inline sizeof wchar_t const_cast int static while constexpr long static_assert xor continue mutable static_cast xor_eq Operator Meaning Associativity Usage * / % multiply divide modulo left left left expr * expr expr / expr expr % expr + - add subtract left left expr + expr expr - expr > bitwise shift left‡ bitwise shift right‡ left left expr > expr < >= less than less than or equal to greater than greater than or equal to left left left left expr < expr expr expr expr >= expr == != equal not equal left left expr == expr expr != expr & bitwise AND left expr & expr ^ bitwise EXCLUSIVE OR left expr ^ expr | bitwise OR left expr | expr && logical AND left expr && expr || logical OR left expr || expr ? : conditional left expr ? expr : expr = *= /= %= += -= = &= |= ^= assign multiply and assign divide and assign modulo and assign add and assign subtract and assign shift left and assign shift right and assign AND and assign OR and assign EXCLUSIVE OR and assign left left left left left left left left left left left lvalue = expr lvalue *= expr lvalue /= expr lvalue %= expr lvalue += expr lvalue -= expr lvalue = expr lvalue &= expr lvalue |= expr lvalue ^= expr , comma left expr, expr ‡ Typically overloaded for I/O Data Abstraction & Problem Solving with C++ WALLS AND MIRRORS SIXTH EDITION Frank M Carrano University of Rhode Island Timothy Henry University of Rhode Island Vice President and Editorial Director, ECS: Marcia J Horton Executive Editor: Tracy Johnson Associate Editor: Carole Snyder Director of Marketing: Christy Lesko Marketing Manager: Yez Alayan Marketing Assistant: Jon Bryant Director of Production: Erin Gregg Managing Editor: Jeff Holcomb Associate Managing Editor: Robert Engelhardt Manufacturing Buyer: Lisa McDowell Art Director: Anthony Gemmellaro Cover Designer: Liz Harasymczuk Permissions Supervisor: Michael Joyce Permissions Administrator: Jenell Forschler Director, Image Asset Services: Annie Atherton Manager, Visual Research: Karen Sanatar Cover Art: Shutterstock/SVLuma Media Project Manager: Renata Butera Full-Service Project Management: Rose Kernan Composition: Cenveo Publisher Services / Nesbitt Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Color/Hagerstown Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on the appropriate page within text Copyright © 2013, 2007, 2005 Pearson Education, Inc., publishing as Addison-Wesley All rights reserved Printed in the United States of America This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise To obtain permission(s) to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290 Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps Library of Congress Cataloging-in-Publication Data on file 10 ISBN 10: 0-13-292372-6 ISBN 13: 978-0-13-292372-9 the publication of the first edition, we all have gained experience with teaching data abstraction in an objectoriented way using C++ This edition reflects that experience and the many comments and suggestions received from faculty and students alike I am happy to introduce Dr Timothy Henry, my co-author and colleague at the University of Rhode Island Together, we have given this book a much needed revision and a new look However, our goal remains to give students a superior foundation in data abstraction, object-oriented programming, and other modern problemsolving techniques All C++ code has been rewritten with a focus on safe and secure programming practices It also adheres to the C++11 standard We hope that you enjoy reading this book Like many others before you, you can learn—or teach—data structures in an effective and sustainable way Welcome Welcome to the sixth edition of Data Abstraction & Problem Solving with C++: Walls and Mirrors Since Talk to Us Walls and Mirrors continues to evolve Your comments, suggestions, and corrections will be greatly appreciated Here are a few ways to reach us: • • • • E-mail: carrano@acm.org Facebook: www.facebook.com/makingitreal Twitter: twitter.com/Frank_M_Carrano Blog: frank-m-carrano.com/makingitreal iii A Note to Students iv The topics that we cover in this book deal with the various ways of organizing data so that a given application can access and manipulate data in an efficient way These topics are fundamental to your future study of computer science, as they provide you with the foundation of knowledge required to create complex and reliable software Whether you are interested in designing video games or software for robotic-controlled surgery, the study of data structures is vital to your success Even if you not study all of the topics in this book now, you are likely to encounter them later We hope that you will enjoy reading the book, and that it will serve as a useful reference tool for your future courses The walls and mirrors in the title represent two fundamental problem-solving techniques that appear throughout the presentation Data abstraction isolates and hides the implementation details of a module from the rest of the program, much as a wall can isolate and hide you from your neighbor Recursion is a repetitive technique that solves a problem by solving exactly the same but smaller problems, much as images in facing mirrors grow smaller with each reflection Please be sure to browse the rest of this preface to see the features that will help you in your studies To help you learn and to review for exams, we have included such learning aids as video tutorials (VideoNotes), checkpoint questions with answers, margin notes, programming tips, chapter summaries, and a glossary As a help during programming, you will find C++ reference material in the appendices and inside the covers You should review the list of this book’s features given later in this preface in the section “Features to Enhance Learning.” The presentation makes some basic assumptions about your knowledge of C++ Some of you may need to review this language or learn it for the first time by consulting the appendices of this book This book covers C++ classes and other relevant aspects of the language in new C++ Interludes that occur throughout the book between certain chapters These interludes not assume that you already know their topics We assume no experience with recursive functions, which are included in Chapters and All of the C++ source code that appears in this book is available for your use Later in this preface, the description of supplementary materials tells you how to obtain these files, as well as the VideoNotes and other online documents This book’s organization, sequencing, and pace of topic coverage make learning and teaching easier by focusing your attention on one concept at a time, by providing flexibility in the order in which you can cover topics, and by clearly distinguishing between the specification and implementation of abstract data types, or ADTs To accomplish these goals, we have organized the material into 21 chapters Most chapters focus on either the specification and use of an ADT or its various implementations You can choose to cover the specification of an ADT followed by its implementations, or you can treat the specification and use of several ADTs before you consider any implementation issues The book’s organization makes it easy for you to choose the topic order that you prefer Table of Contents at a Glance The following list shows the overall composition of the book A further chapter-by-chapter description appears later Note that gray highlighted sections are available online Chapter Data Abstraction: The Walls C++ Interlude C++ Classes Chapter Recursion: The Mirrors Chapter Array-Based Implementations C++ Interlude Pointers, Polymorphism, and Memory Allocation Chapter Link-Based Implementations Chapter Recursion as a Problem-Solving Technique Chapter Stacks C++ Interlude Exceptions Chapter Stack Implementations Chapter Lists Chapter List Implementations Chapter 10 Algorithm Efficiency Chapter 11 Sorting Algorithms and Their Efficiency C++ Interlude Class Relationships and Reuse Chapter 12 Sorted Lists and Their Implementations Chapter 13 Queues and Priority Queues Chapter 14 Queue Implementations C++ Interlude Overloaded Operators and Friend Access Chapter 15 Trees Chapter 16 Tree Implementations C++ Interlude Iterators Chapter 17 Heaps Chapter 18 Dictionaries and Their Implementations Chapter 19 Balanced Search Trees Chapter 20 Graphs Chapter 21 Processing Data in External Storage C++ Interlude The Standard Template Library Appendix A Review of C++ Fundamentals Appendix B Important Themes in Programming Appendix C The Unified Modeling Language Appendix D The Software Life Cycle Appendix E Mathematical Induction Appendix F Algorithm Verification Appendix G Files Appendix H C++ Header Files and Standard Functions Appendix I C++ Documentation Systems Appendix J ASCII Character Codes Appendix K C++ for Java Programmers Appendix L C++ for Python Programmers Index Glossary Answers to Checkpoint Questions Brief Table of Contents Organization v New to this Edition What’s New? T his edition of Walls and Mirrors is a significant revision of the previous edition, yet remains committed to a pedagogical approach that makes the material accessible to students at the introductory level Although everything looks new, you will find the coverage that you enjoyed in previous editions is still here At a glance, the book has more—but shorter—chapters, a second color, and new C++ Interludes Let’s examine the details Organization The book begins with a shorter Chapter 1, so that it can focus on the specification of abstract data types (ADTs) After general discussions of problem solving, good programming practices, and ADTs, we specify a simple ADT—the bag We define the bag’s operations within a C++ template interface in a non-threatening way We have moved some sections from the original first chapter to the appendices By introducing the bag as the first ADT we consider, we make the difficult topic of linked data more accessible to students Adding or removing the first node in a chain of linked nodes is the easiest task, and these simple manipulations are the ones we need to use for a linked implementation of the bag The next ADT that we consider is the stack, a more useful data container that has the same simple chain in one of its definitions Moreover, many students are already familiar with stacks Later, the treatment of lists looks at the more involved operations of adding and removing a node that lies between existing nodes of a chain The rest of the coverage will be familiar to previous users of Walls and Mirrors but often you will find ADTs presented in two chapters rather than one These chapters separate the discussions of specification and implementation We will describe each chapter later in this preface To summarize, this organization • Replaces Chapter with an introduction to ADTs and template interfaces using the ADT bag • Provides a more focused introduction to array-based implementations and link-based implementations using the ADT bag • Makes the topic of linked data more accessible to students by discussing it progressively as we introduce the ADTs bag, stack, and list • Places greater emphasis on data abstraction as a problem solving tool • Enhances the separation between specification and implementation of basic ADTs by placing them in successive chapters • Specifies ADTs informally at first, then in UML, and ultimately in C++ template interfaces • Demonstrates safe and secure programming practices in completely revised code that adheres to the C++11 standard • Covers the ADT heap in its own chapter • Reorganizes the coverage of the ADT dictionary (formerly called the ADT table) into two chapters C++ Interludes The introduction of C++ classes and other aspects of C++ that we need for our presentation and were previously covered in Chapters 3, 4, and of the previous edition are now featured in C++ Interludes Seven of these “mini-chapters” appear throughout the book to cover relevant C++ topics as we need them Note that these interludes separate the details of C++ from the discussion of data structures VideoNotes Online tutorials are a Pearson feature that provides visual and audio support to the presentation given throughout the book They offer students another way to recap and reinforce key concepts VideoNotes allow for self-paced instruction with easy navigation, including the ability to select, play, rewind, fast-forward, and stop within each video Unique VideoNote icons appear throughout this book whenever a video is available for a particular concept or problem A detailed list of the 49 VideoNotes for this text and their associated locations in the book can be found on page xxiii VideoNotes are free with the purchase of a new textbook To purchase access to VideoNotes, please go to www.pearsonhighered.com/carrano vi • Adds a second color to enhance the effectiveness of the illustrations, distinguish pseudocode from C++ code, and provide visual interest • Includes Notes and Programming Tips to emphasize key material and offer programming advice • Distinguishes major pieces of code in a new Listing element • Replaces the self-test exercises at the ends of chapters with Checkpoint Questions placed throughout the chapters • Numbers sections and subsections for easy reference • Includes transition guides from Python to C++ and Java to C++ New to this Edition Other features Walls and Mirrors now has many new features that enhance its usefulness to both readers and instructors This edition vii Index *, pointer variables, 121 h, header files, 32, 99–100 ==, equality operator, 416–417, 495 !=, inequality operator, 495 ( ), algebraic expressions, 165–166, 171–172, 207–208 ( ), predicate expressions, Python, 790 *, return item operator, 495 ––, move to previous item (prefix) operator, 495, 496 cpp implementation files, 32 ;, functions declaration, 698 @throws javadoc tag, 232 { }, compound statements, 700, 790 { }, checking balance, 201–203 ~, destructors, 146 +, concatenation operator, overloading, 419–420 ++, move to next item (postfix) operator, 495, 496 < >, data types, 39

Ngày đăng: 30/03/2020, 21:37

TỪ KHÓA LIÊN QUAN