1
STRATEGIES FOR PROBLEM SOLVING
The Fox, the Goose, and the Corn
Problem: How to Cross the River?
Problem: Completing a Sudoku Square
Problem: Opening the Alien Lock
General Problem-Solving Techniques
Review of C++ Used in This Chapter
Problem: A Square (Half of a Square Reduction)
Problem: A Line (Half of a Square Further Reduction)
Problem: Count Down by Counting Up
Problem: Luhn Checksum Validation
Problem: Convert Character Digit to Integer
Problem: Luhn Checksum Validation, Fixed Length
Problem: Simple Checksum Validation, Fixed Length
Problem: Reading a Number with Three or Four Digits
Problem: Reading a Number with Three or Four Digits, Further Simplified
4
SOLVING PROBLEMS WITH POINTERS AND DYNAMIC MEMORY
Review of Pointer Fundamentals
Problem: Variable-Length String Manipulation
Problem: Tracking an Unknown Quantity of Student Records
5
SOLVING PROBLEMS WITH CLASSES
Problem: Tracking an Unknown Quantity of Student Records
The Big Picture for Classes with Dynamic Memory
6
SOLVING PROBLEMS WITH RECURSION
Review of Recursion Fundamentals
Problem: Who’s Our Best Customer?
Problem: Computing the Sum of an Array of Integers
Applying Recursion to Dynamic Data Structures
Problem: Counting Negative Numbers in a Singly Linked List
Problem: Find the Largest Value in a Binary Tree
Problem: Find the Number of Leaves in a Binary Tree
Problem: Display a Linked List in Order
Problem: Display a Linked List in Reverse Order
7
SOLVING PROBLEMS WITH CODE REUSE
Review of Component Fundamentals
Problem: Sorting Some, Leaving Others Alone
Playing to Your Strengths and Weaknesses
Putting the Master Plan Together
Required Operations for Cheating at Hangman
Learning New Programming Skills