Correlation to the Previous Edition

This Book (3E) What's New Previous Book (2E)
Global Changes
  • This edition provides many new examples and exercises to motivate and stimulate student interest in programming. (This is the hallmark for every new edition of the Liang book.)
  • The string objects are introduced early in Chapter 4 to enable strings to be used in early part of the book. (This big change triggers rewriting many parts of the book.)
  • Many chapters in early part of the book have a section on common errors and pitfalls to steer students away from common programming errors.
  • Complex examples such as the Sudoku problem in Chapter 7 are moved to the companion Website and replaced by simpler examples.
  • Key Point is provided at the beginning of each section to summarize the important concepts and materials for the section.
  • Check Point is provided at the end of the section to check student's understanding of the material covered in the section.
  • Links to quiz are provided at the end of chapter to test student's understanding for the whole chapter.
  • Links to author-developed animations to demonstrate how algorithms (such as linear search, binary search, selection sort, binary search tree, heap, hashing, etc.) work.
  • Functions are now combined into Chapter 6 that covers all issues related to functions in one place.
  • Use the notation type& rather than type &v for reference parameters consistently.
  • Use the notation type* rather than type *v for pointers consistently.
  • Consistently use the const reference parameters and constant member functions.
  • Revised the UML diagram to denote const reference parameters and constant member functions.
  • Chapter 18 is expanded to introduce algorithmic techniques: dynamic programming, divide-and-conquer, backtracking, and greedy algorithm with new examples to design efficient algorithms.
  • Visual animations are created to show how data structures and algorithms work.
  • C++11 new features on foreach loops and auto type inference are covered in the bonus chapters.
  • C++11 lambda functions are introduced in the supplement.
  • A tutorial of Visual C++ 2012 is provided in the supplement.
 
Chapter 1 Introduction to Computers, Programs, and Java
  • The introduction to computers and programming languages has been updated.
  • Move the section on syntax errors, runtime errors, and logic errors from Chapter 2 to Chapter 1 to introduce programming errors early on.
  • Move programming style and doc here from Chapter 2 to Chapter 1 to foster good programming style early.
  • Move VC++ tutorial to Supplement.
  • Move g++ tutorial to Supplement.
  • New exercises 1.8-1.12.
Chapter 1
Chapter 2 Elementary Programming
  • New introductory problem to motivate students.
  • Add software development process section to introduce analysis and design as well coding.
  • Expand the coverage on debugging.
  • Add a new section on Common Errors and Pitfalls
  • Move the section on syntax errors, runtime errors, and logic errors to Chapter 1 to introduce programming errors early on.
  • Move the character type to Chapter 4.
Chapter 2
Chapter 3 Selections
  • New Chinese Zodiac example for switch statements.
  • New figure to show multiple-alternative if statements
  • Add a new section on Common Errors and Pitfalls
  • Add debugging in this chapter.
  • Move examples and exercises using characters to Chapter 4.
  • New exercises 3.32-3.35.
Chapter 3
Chapter 4 Mathematical Functions, Characters, and Strings
  • This new chapter introduces mathematical functions, strings, and simple IO to enable you to use these features in the examples and exercises early in the book.
  • Introduce the string type.
  • Introduce output format.
  • Introduce simple file I/Os.
New Chapter
Chapter 5 Loops
  • New AdditionQuiz example to terminate the loop until a correct answer is entered.
  • New examples using strings.
  • Use a new and more effective example for introducing the break statement.
  • New exercises 5.43-5.51.
Chapter 4
Chapter 6 Functions
  • Combine Chapters 5 and 6 of the previous edition into this new chapter.
  • Revise several diagrams.
  • New examples using strings.
  • Move mathematical functions and character functions to Chapter 4.
  • Use the notation type& rather than type &v for reference parameters consistently.
  • New Exercises 6.36–6.44.
Chapters 5 and 6
Chapter 7 Single-Dimensional Arrays and C-Strings
  • New examples involving strings.
  • Move insertion sort to Chapter 19.
  • Revised several diagrams.
  • Consistently use const for the array parameters not changed in the function for good programming practice.
  • New Exercises 7.35–7.37.
Chapter 7
Chapter 8 Multidimensional Arrays
  • New problem-driven introduction.
  • A simplified version of Sudoku is presented to make the example accessible to novice students. The complete solution to the Sudoku problem is moved to Supplement VI.A.
  • Two math exercises are replaced by new game exercises.
  • New exercises 8.35–8.39.
Chapter 8
Chapter 9 Objects and Classes
  • New problem-driven introduction.
  • New TV class example.
  • Introduce inclusion guard and apply it consistently for all class definitions in the header file.
  • New exercises 9.7-9.11.
Chapter 9
Chapter 10 Object-Oriented Thinking
  • New problem-driven introduction.
  • Add a new section on splitting strings using the stringstream class.
  • Thinking in Objects.
  • New examples for transition from procedural programming to OOP.
Chapter 10
Chapter 11 Pointers and Dynamic Memory Management
  • Cover destructors and copy constructor along with pointers.
  • New examples to demonstrate passing pointers to a function by value and by reference.
  • Introduce the typedef keyword for defining synonymy for types.
  • New examples for destructors and copy constructors.
  • Introduce the constant member functions and use it consistently in the examples throughout the book.
  • Use the notation type* rather than type *v for pointers consistently.
  • New exercises 11.8-11.9.
Chapter 11
Chapter 12 Templates, Vectors, and Stacks
  • The vector class is introduced in this chapter.
  • Use vector to replace arrays.
  • Consistently use the const reference parameters and constant member functions.
  • New exercises 12.9-12.12.
Chapter 12
Chapter 13 File Input and Output
  • Add a new section on letting the user enter a filename.
  • New coverage on random access files.
  • New examples for binary IO and random access IO with the fixed-length student records.
  • New exercises 13.9-13.15.
Chapter 13
Chapter 14 Operator Overloading
  • Introduce friend functions before overloading << and >> operators
  • Add a new section on defining non-member functions for operators.
  • New section on automatic conversion between a primitive type and an object type.
  • Consistently use the const reference parameters and constant member functions.
  • New exercises 14.8-14.10.
Chapter 14
Chapter 15 Inheritance and Polymorphism
  • New problem-driven introduction.
  • New separate sections on polymorphism and dynamic binding using virtual functions.
  • Discuss static binding and dynamic binding.
  • A new section of casting and discuss the differences between static_cast and dynamic_cast.
  • Consistently use the const reference parameters and constant member functions.
  • New exercises 15.7-15.15.
Chapter 15
Chapter 16 Exception Handling
  • New problem-driven introduction.
  • New section on multiple catches.
  • New exercises 16.5-16.8.
Chapter 16
Chapter 17 Recursion
  • New problem-driven introduction.
  • Use string objects to replace C-Strings in the examples.
  • New exercises 17.18-17.21.
Chapter 17
Bonus Chapter 18 Developing Efficient Algorithms
  • Introduce common algorithm development techniques using dynamic programming, divide-and-conquer, and backtracking.
  • New example on convex hull algorithms.
Chapter 18
Bonus Chapter 19 Sorting
  • New problem-driven introduction.
  • Insertion sort is moved from Chapter 6 here.
Chapter 19
Bonus Chapter 20 Linked Lists, Stacks, and Queues
  • Expand the coverage on iterators and implement both prefix and postfix ++ operator for LinkedList iterator.
  • C++11 foreach loop.
  • Consistently use the const reference parameters and constant member functions.New exercises 20.9-20.10.
Chapter 20
Bonus Chapter 21 Binary Search Trees
  • Consistently use the const reference parameters and constant member functions.
  • New exercises 21.8-21.11.
Chapter 21
Bonus Chapter 22 STL Containers
  • No changes
Chapter 22
Bonus Chapter 23 STL Algorithms
  • C++11 auto type inference
Chapter 23
Bonus Chapter 24 Graph Applications
  • Consistently use the const reference parameters and constant member functions.
  • Use adjacency edge lists to store edges Instead of using the adjacency vertex lists. This provides great flexibility in designing resusable code. The weighted edges in the next chapter can be stored using the same adjacency lists.
  • The new methods for adding vertices and adding edges.
  • New exercises 24.8–32.14.
Chapter 24
Bonus Chapter 25 Weighted Graph Applications
  • Consistently use the const reference parameters and constant member functions.
  • Use adjacency edge list to store edges rather than using priority queues to simplify implementations of the MST and SP algorithms.
  • A simple O(|V|2) implementation for MST is provided. The O(|E|log|V|) implementation using the priority-queues is now an exercise.
  • A simple O(|V|2) implementation for SP is provided. The O(|E|log|V|) implementation using the priority-queues is now an exercise.
  • New exercises 25.9–32.13.
Chapter 25
Bonus Chapter 26 AVL Trees and Splay Trees
  • Consistently use the const reference parameters and constant member functions.
Chapter 26