25-Comp-A4 Program Design and Data Structures
Worked solutions to 7 past sittings (2013–2019), 61 questions. Pick a sitting, or start from a topic below.
Study guide for this subject
The study guide for this subject maps 14 topics across the 7 sittings it covers. It works 14 recurring problem types as step-by-step methods and has a formula sheet of 25 entries.
The topics it maps, and how many of those sittings each came up in:
- C++ class for a mathematical object (complex number, set, vector, matrix) (in 7 of 7 sittings)
- Binary tree traversals and search-tree updates (in 6 of 7 sittings)
- Linked-list data structures (stack, queue, sorted list, polynomial) (in 7 of 7 sittings)
- Merging or intersecting sorted files (in 4 of 7 sittings)
- Single-pass scanning of a file (word counts, bracket matching, comparison, encoding) (in 6 of 7 sittings)
- Removing duplicates from an array: comparing two methods (in 3 of 7 sittings)
- One-pass partition of a 0/1 array (in 3 of 7 sittings)
- Self-describing integers (in 3 of 7 sittings)
- Two-dimensional array scan: magic square and saddle point (in 4 of 7 sittings)
- Reversing a line of text and sorting small records (in 3 of 7 sittings)
- Validating a date and looking it up in a range table (in 2 of 7 sittings)
- Crypto-arithmetic puzzle by backtracking (in 2 of 7 sittings)
- Enumerating a small design space: cost and series reliability (in 2 of 7 sittings)
- Repeated-division puzzle solved by brute force (in 2 of 7 sittings)
Open the study guide 🔒What the Pass includes
The full guide comes with the Computer Engineering Pass, which is not on sale yet. The worked solutions stay free, with or without a Pass.
Like the solutions, the guide is AI-drafted, checked by scripts and against cited sources, and edited by the operator; it may contain errors. Last checked 6 November 2026.
Topics across the sittings
Topics that come up in more than one of the 7 sittings, taken from the headings of our worked solutions. Each cell links to that sitting's questions on the topic; a blank cell means no question heading in that sitting names it. Tick them off as you study in our topic checklist.
| Topic | Sittings | May 2013 | Dec 2014 | May 2016 | Dec 2016 | Dec 2017 | Dec 2018 | Dec 2019 |
|---|---|---|---|---|---|---|---|---|
| Algorithm Design | 7 | Q8 | Q9 | Q8 | Q8 | Q9 | Q9 | Q9 |
| File I/O | 7 | Q6 Q7 | Q7 Q8 | Q6 Q7 | Q4 Q5 | Q4 Q5 | Q4 Q5 | Q4 Q5 |
| Object-Oriented Design | 7 | Q4 | Q4 | Q3 | Q6 | Q6 | Q6 | Q6 |
| Programming | 7 | Q1 Q2 Q3 | Q1 Q2 Q3 | Q1 Q2 | Q1 Q2 Q3 | Q1 Q2 Q3 | Q1 Q2 Q3 | Q1 Q2 Q3 |
| Pointer-based Data Structures | 6 | Q5 | Q4 Q5 | Q7 | Q7 | Q7 Q8 | Q7 | |
| Traversals | 6 | Q6 | Q5 | Q9 | Q8 | Q8 | Q7 | |
| Linked Lists | 5 | Q5 | Q4 | Q7 | Q7 | Q8 | ||
| Sorting | 5 | Q8 | Q3 | Q8 | Q2 | Q9 | ||
| Binary Trees | 4 | Q6 | Q5 | Q9 | Q8 | |||
| Merging Two Sorted Files | 3 | Q7 | Q5 | Q5 | ||||
| C++ Complex Number Class | 2 | Q4 | Q6 | |||||
| C++ Set Class | 2 | Q3 | Q6 | |||||
| Horoscope Sign | 2 | Q1 | Q1 | |||||
| Line Reversal | 2 | Q3 | Q2 | |||||
| Self-Describing Integers | 2 | Q2 | Q2 |
Questions by sitting
December 2019
- Question 1: Programming — Horoscope Sign and Compatibility
- Question 2: Programming — Reverse a Line and the Saddle Point
- Question 3: Programming — Crypto-Arithmetic Puzzle
- Question 4: File I/O — Lines and Words per Line
- Question 5: File I/O — Merging Two Sorted Files
- Question 6: Object-Oriented Design — A C++ Complex Number Class
- Question 7: Pointer-based Data Structures — Preorder Traversal and find_min_leaf
- Question 8: Linked Lists — Polynomial Representation
- Question 9: Algorithm Design and Sorting — Removing Duplicates
December 2018
- Question 1: Programming — Sphere Buoyancy and a Subsystem Trade Study
- Question 2: Programming — Self-Describing Integers
- Question 3: Programming — Magic Square Checker
- Question 4: File I/O — Average Word Length
- Question 5: File I/O — Balanced Parentheses
- Question 6: Object-Oriented Design — A C++ Set Class
- Question 7: Pointer-based Data Structures — Duplicating Every Node of a Linked List
- Question 8: Pointer-based Data Structures — Inorder Traversal
- Question 9: Algorithm Design — One-Pass 0/1 Array Partition
December 2017
- Question 1: Programming — Floyd's Triangle and the Three-Way Gold-Bar Division
- Question 2: Programming — Hailstone (Collatz) Sequence
- Question 3: Programming — Saddle Point in a 2-D Array
- Question 4: File I/O — Whitespace-Insensitive File Comparison
- Question 5: File I/O — Merging Two Sorted Files
- Question 6: Object-Oriented Design — A C++ Matrix Class
- Question 7: Pointer-Based Data Structures — Doubly Linked List and a Stack Module
- Question 8: Binary Trees — Traversals and Reconstruction
- Question 9: Algorithm Design — Recursive Palindrome Test
December 2016
- Question 1: Programming — Extension-Cord Selection and ISBN Validation
- Question 2: Programming — Line Reversal and Three-Way Coordinate Sorting
- Question 3: Programming — VLSI Wire Intersection Detection
- Question 4: File I/O — Personalized Mail Merge
- Question 5: File I/O — Run-Length Encoding
- Question 6: Object-Oriented Design — A Templated Vector Class
- Question 7: Pointer-Based Data Structures — Linked-List Queue
- Question 8: Algorithm Design — One-Pass 0/1 Partition
- Question 9: Binary Trees — Traversals and BST Maintenance
May 2016
- Question 1: Programming — Horoscope Sign and Element Compatibility
- Question 2: Programming — Self-Describing Integers and a Crypto-Arithmetic Solver
- Question 3: Object-Oriented Design — A C++ Set Class
- Question 4: Pointer-based Data Structures — Sorted Doubly Linked List
- Question 5: Pointer-based Data Structures — Binary Tree Traversal
- Question 6: File I/O — Names Common to Three Sorted Files
- Question 7: File I/O — Merging Two Sorted Files
- Question 8: Algorithm Design and Sorting — Deduplicating a Large Array
December 2014
- Question 1: Programming — Sliding-Scale Commission and a Check Digit
- Question 2: Programming — Cost and Reliability of Every Subsystem Combination
- Question 3: Programming — Line Reversal and Three-Way Sorting
- Question 4: Object-Oriented Design — A C++ Complex Number Class
- Question 5: Linked Lists — Building and Adding Polynomials
- Question 6: Binary Trees — Traversals and Search-Tree Updates
- Question 7: File I/O — Testing Two Files for High Similarity
- Question 8: File I/O — Replicating and Interleaving a Sound Stream
- Question 9: Algorithm Design — One-Pass Partition of a Binary Array
May 2013
- Question 1: Programming
- Question 2: Programming
- Question 3: Programming
- Question 4: Object-Oriented Design
- Question 5: Pointer-based Data Structures
- Question 6: File I/O
- Question 7: File I/O
- Question 8: Algorithm Design and Sorting