(0) items

Programming Abstractions in C++,9780133454840
This item qualifies for


Your order must be $59 or more, you must select US Postal Service Shipping as your shipping preference, and the "Group my items into as few shipments as possible" option when you place your order.

Bulk sales, PO's, Marketplace Items, eBooks, Apparel, and DVDs not included.

Programming Abstractions in C++



Pub. Date:
Prentice Hall
List Price: $154.40

Rent Textbook


Buy New Textbook

Currently Available, Usually Ships in 24-48 Hours



Used Textbook

We're Sorry
Sold Out

More New and Used
from Private Sellers
Starting at $154.71
See Prices

Questions About This Book?

Why should I rent this book?
Renting is easy, fast, and cheap! Renting from can save you hundreds of dollars compared to the cost of new or used books each semester. At the end of the semester, simply ship the book back to us with a free UPS shipping label! No need to worry about selling it back.
How do rental returns work?
Returning books is as easy as possible. As your rental due date approaches, we will email you several courtesy reminders. When you are ready to return, you can print a free UPS shipping label from our website at any time. Then, just return the book to your UPS driver or any staffed UPS location. You can even use the same box we shipped it in!
What version or edition is this?
This is the 1st edition with a publication date of 7/28/2013.
What is included with this book?
  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any CDs, lab manuals, study guides, etc.
  • The Rental copy of this book is not guaranteed to include any supplemental materials. You may receive a brand new copy, but typically, only the book itself.


This text is intended for use in the second programming course


Programming is a matter of learning by doing. Eric Roberts’ Programming Abstractions in C++ gives students opportunities to practice and learn with engaging graphical assignments. A client-first approach to data structures helps students absorb, and then apply the material.


Teaching and Learning Experience

This program presents a better teaching and learning experience—for you and your students. It will help:

  • Improve Student Comprehension with a Client-first Approach to Data Structures: To aid in student understanding, this book presents the full set of collection classes early.
  • Defer the Presentation of C++ Features that Require a Detailed Understanding of the Underlying Machine: Introducing collection classes early enables students to master other equally important topics without having to struggle with low-level details at the same time.
  • Engage Students with Exciting Graphical Assignments: An open-source library supports graphics and interactivity in a simple, pedagogically appropriate way.
  • Support Instructors and Students: The companion website provides source code, sample run PDFs, answers to review questions, and more.

Author Biography

After receiving his Ph.D. in Applied Mathematics from Harvard University in 1980, Eric Roberts taught at Wellesley College from 1980-85, where he chaired the Computer Science Department. From 1985-90, he was a member of the research staff at Digital Equipment Corporation’s Systems Research Center in Palo Alto, California, where he conducted computer science research, focusing on programming tools for multiprocessor architectures. In September 1990, Roberts joined the Stanford faculty, where he is now Professor of Computer Science and the John A. and Cynthia Fry Gunn University Fellow in Undergraduate Education.

From 1990 to 2002, Professor Roberts was Associate Chair and Director of Undergraduate Studies for Computer Science. In that capacity, he was the principal architect of Stanford’s introductory programming sequence, which for many years held the distinction of being the largest course at Stanford. He has also written four computer science textbooks that are used at many colleges and universities throughout the world. His research focuses on computer science education, particularly for underserved communities. From 1998 to 2005, Roberts was Principal Investigator for the Bermuda Project, which developed the computer science curriculum for Bermuda’s public secondary schools.

While at Stanford, Professor Roberts has received several university- level teaching awards, including the Bing Fellowship, established “to recognize excellence in teaching and a committed interest to the teaching of undergraduates”; the Dinkelspiel Award, which recognizes “distinctive and exceptional contributions to undergraduate education”; and the Laurance and Naomi Carpenter Hoagland Prize, awarded for excellence in undergraduate teaching. In January 2002, Roberts was named one of the first eight University Fellows in Undergraduate Education, which are designed “to reward faculty who make truly outstanding contributions to Stanford’s undergraduate experience.”

Professor Roberts has been active in professional organizations dedicated to computer science education. From 2005 to 2007, he served as co-chair of the Education Board of the Association of Computing Machinery (ACM) and was for many years on the board of the ACM Special Interest Group on Computer Science Education (SIGCSE). From 1998 to 2001, Roberts served as co-chair and principal editor for the ACM/IEEE- CS Joint Task Force on Computing Curricula 2001, which published a detailed set of curriculum guidelines in December 2001. He also chaired the ACM Java Task Force from 2004 to 2006. In 2003, Roberts received the SIGCSE Award for Outstanding Contribution to Computer Science Education. Professor Roberts is a Fellow of the ACM and the American Association for the Advancement of Science (AAAS).

Professor Roberts has also been active in several organizations seeking to promote socially responsible use of science and technology. He is past president of both Computer Professionals for Social Responsibility, a public-interest organization of computer scientists and other professionals concerned about the impact of computer technology on society, and Student Pugwash USA, which encourages students to use their training in science and technology to create a better world. In 1999-2000, Roberts was the Eugene M. Lang Visiting Professor for Social Change at Swarthmore College.

Table of Contents

1 Overview of C++ 1
1.1 Your first C++ program 2
1.2 The history of C++ 3
1.3 The structure of a C++ program 6
1.4 Variables 14
1.5 Data types 19
1.6 Expressions 26
1.7 Statements 36
Summary 47
Review questions 48
Exercises 50
2 Functions and Libraries 55
2.1 The idea of a function 56
2.2 Libraries 59
2.3 Defining functions in C++ 61
2.4 The mechanics of function calls 65
2.5 Reference parameters 73
2.6 Interfaces and implementations 78
2.7 Principles of interface design 85
2.8 Designing a random number library 90
2.9 Introduction to the Stanford libraries 107
Summary 112
Review questions 114
Exercises 115
3 Strings 125
3.1 Using strings as abstract values 126
3.2 String operations 129
3.3 The <cctype> library 137
3.4 Modifying the contents of a string 138
3.5 The legacy of C-style strings 139
3.6 Writing string applications 140
3.7 The strlib.h library 146
Summary 147
Review questions 148
Exercises 149
4 Streams 159
4.1 Using strings as abstract values 160
4.2 Formatted input 165
4.3 Data files 167
4.4 Class hierarchies 181
4.5 The simpio.h and filelib.h libraries 186
Summary 188
Review questions 189
Exercises 190
5 Collections 195
5.1 The Vector class 197
5.2 The Stack class 211
5.3 The Queue class 217
5.4 The Map class 226
5.5 The Set class 232
5.6 Iterating over a collection 236
Summary 243
Review questions 245
Exercises 246
6 Designing Classes 261
6.1 Representing points 262
6.2 Operator overloading 268
6.3 Rational numbers 281
6.4 Designing a token scanner class 292
6.5 Encapsulating programs as classes 301
Summary 303
Review questions 305
Exercises 306
7 Introduction to Recursion 315
7.1 A simple example of recursion 316
7.2 The factorial function 318
7.3 The Fibonacci function 325
7.4 Checking palindromes 332
7.5 The binary search algorithm 335
7.6 Mutual recursion 336
7.7 Thinking recursively 338
Summary 340
Review questions 342
Exercises 344
8 Recursive Strategies 349
8.1 The Towers of Hanoi 350
8.2 The subset-sum problem 361
8.3 Generating permutations 364
8.4 Graphical recursion 368
Summary 375
Review questions 375
Exercises 376
9 Backtracking Algorithms 389
9.1 Recursive backtracking in a maze 390
9.2 Backtracking and games 400
9.3 The minimax algorithm 409
Summary 415
Review questions 416
Exercises 417
10 Algorithmic Analysis 429
10.1 The sorting problem 430
10.2 Computational complexity 435
10.3 Recursion to the rescue 443
10.4 Standard complexity classes 449
10.5 The Quicksort algorithm 452
10.6 Mathematical induction 458
Summary 462
Review questions 463
Exercises 466
11 Pointers and Arrays 473
11.1 The structure of memory 474
11.2 Pointers 484
11.3 Arrays 494
11.4 Pointer arithmetic 500
Summary 506
Review questions 508
Exercises 510
12 Dynamic Memory Management 515
12.1 Dynamic allocation and the heap 516
12.2 Linked lists 519
12.3 Freeing memory 523
12.4 Defining a CharStack class 527
12.5 Heap-stack diagrams 536
12.6 Unit testing 543
12.7 Copying objects 546
12.8 The uses of const 550
12.9 Efficiency of the CharStack class 558
Summary 560
Review questions 562
Exercises 564
13 Efficiency and Representation 569
13.1 Software patterns for editing text 570
13.2 Designing a simple text editor 572
13.3 An array-based implementation 579
13.4 A stack-based implementation 586
13.5 A list-based implementation 591
Summary 607
Review questions 608
Exercises 610
14 Linear Structures 615
14.1 Templates 616
14.2 Implementing stacks 619
14.3 Implementing queues 634
14.4 Implementing vectors 649
14.5 Integrating prototypes and code 656
Summary 657
Review questions 658
Exercises 659
15 Maps 663
15.1 Implementing maps using vectors 664
15.2 Lookup tables 668
15.3 Hashing 671
15.4 Implementing the HashMap class 682
Summary 683
Review questions 684
Exercises 685
16 Trees 689
16.1 Family trees 691
16.2 Binary search trees 693
16.3 Balanced trees 706
16.4 Implementing maps using BSTs 717
16.5 Partially ordered trees 719
Summary 722
Review questions 724
Exercises 727
17 Sets 737
17.1 Sets as a mathematical abstraction 738
17.2 Expanding the set interface 742
17.3 Implementation strategies for sets 747
17.4 Optimizing sets of small integers 753
Summary 761
Review questions 762
Exercises 764
18 Graphs 767
18.1 The structure of a graph 768
18.2 Representation strategies 772
18.3 A low-level graph abstraction 776
18.4 Graph traversals 783
18.5 Defining a Graph class 789
18.6 Finding shortest paths 804
18.7 Algorithms for searching the web 808
Summary 812
Review questions 813
Exercises 815
19 Inheritance 823
19.1 Simple inheritance 824
19.2 A hierarchy of graphical shapes 832
19.3 A class hierarchy for expressions 841
19.4 Parsing an expression 861
19.5 Multiple inheritance 870
Summary 873
Review questions 875
Exercises 877
20 Strategies for iteration 885
20.1 Using iterators 886
20.2 Using functions as data values 890
20.3 Encapsulating data with functions 899
20.4 The STL algorithms library 904
20.5 Functional programming in C++ 907
20.6 Implementing iterators 911
Summary 918
Review questions 920
Exercises 921
A Stanford library interfaces 927
Index 1025

Please wait while the item is added to your cart...