A dark, readable revision page for the Programming 622 study guide, focused on C++ software design, STL containers, data structures, searching, sorting, trees and graphs.
These focus areas are built from the guide's topic structure and learning outcomes. Use them as a high-yield revision route before reading the full chapter notes below.
Exam Overview
Programming 622 builds on Programming 621 by moving deeper into C++ data structures and algorithms. The guide covers the software development process, classes, ADTs, STL containers, linked lists, recursion, stacks, queues, searching, hashing, sorting, binary trees, B-trees and graphs.
Revision Area
What To Know
Typical Question Shape
Design and ADTs
Life cycle, analysis, design, classes, data abstraction, constructors and destructors.
Explain, identify class members, write or complete a class interface.
Linear structures
Arrays, vectors, linked lists, stacks and queues.
Trace insert/delete operations, compare array and linked implementations.
Algorithms
Big-O, sequential search, binary search, hashing, sorting and recursion.
Trace an algorithm, state a condition, compare efficiency.
Nonlinear structures
Binary trees, BSTs, AVL rotations, B-trees, graph representation and traversal.
Perform traversal, update a structure, explain shortest path or MST logic.
Exam Focus
Big-O And Algorithm Analysis
The guide introduces algorithm analysis by counting operations rather than machine time. For large inputs, the dominant term matters most: a process that grows like n2 + n is treated as quadratic because n2 dominates.
Exam trap: Do not compare algorithms by how fast they felt on one computer. Compare how operation counts grow as n grows.
Exam Focus
Classes, Encapsulation And ADTs
Object-oriented design identifies objects, their data and their operations. C++ classes support encapsulation, while ADTs describe what operations a structure provides without making the user depend on the implementation details.
Correct pattern: Separate interface from implementation. A stack user needs push, pop and top; they should not need to know whether the stack uses an array or linked nodes.
Exam Focus
Linear Structures: Vector, List, Stack, Queue
Linear structures store items in a sequence, but the access rules differ. Vectors support random access, linked lists adjust links, stacks use Last In First Out, and queues use First In First Out.
Structure
Main Rule
Core Operations
Vector
Dynamic array with random access.
push_back, indexing, iterators.
Linked list
Nodes are connected by links.
Insert node, delete node, traverse.
Stack
Last In First Out.
push, top, pop.
Queue
First In First Out.
addQueue, front, deleteQueue.
Exam Focus
Recursion: Base Case And General Case
Recursion solves a problem by reducing it to smaller versions of itself. The guide stresses two essentials: every recursive definition needs one or more base cases, and the general case must eventually reach a base case.
int fact(int num) {
if (num == 0)
return 1; // base case
return num * fact(num - 1); // general case
}
Common failure: A recursive function with no reachable base case does not solve the problem - it keeps calling itself until the program fails.
Exam Focus
Searching, Hashing And Sorting
Sequential search checks items from the start until the target is found or the list ends. Binary search is faster but requires an ordered array-based list. Hashing uses a hash function to compute a table address, and sorting prepares data for efficient search.
Exam trap: Binary search is not a drop-in replacement for sequential search. It assumes the data is ordered and works naturally with direct index access.
Exam Focus
Trees And Graphs
Binary trees organize data hierarchically with a root, left subtree and right subtree. Graphs use vertices and edges to model relationships, routes and networks. Both require careful traversal rules.
Correct pattern: For tree traversal, remember the root/left/right order. For graph traversal, track visited vertices because graphs can contain cycles and disconnected parts.
General Module Content
Chapter-by-chapter notes from the Programming 622 guide. Everything is visible for continuous revision.
1. Software Engineering Principles And C++ Classes
The guide starts with the software life cycle, software development phases, Big-O, classes, data abstraction and ADTs.
Software life cycleBig-OClassesADT
1.1 Software Life Cycle
A program moves through development, use and maintenance. Maintenance modifies a program to fix problems or improve it; if changes become too expensive, the program may be retired.
1.2 Development Phase
The development process is broken into analysis, design, implementation, testing and debugging. Analysis comes first because the programmer must understand the problem, requirements, data and expected output.
Analysis
Design
Implementation
Testing and debugging
1.3 Algorithm Analysis: Big-O
Algorithm analysis counts operations as a function of input size. A fixed number of operations is constant time; a loop over n items is linear; nested repeated work can become quadratic.
Growth
Meaning
Study Guide Link
O(1)
Fixed amount of work.
Simple statements or direct access.
O(n)
Work grows with list size.
Sequential search and traversal.
O(log n)
Problem is repeatedly divided.
Binary search.
O(n2)
Repeated scans over the data.
Simple comparison sorting patterns.
1.4 Classes
A class groups data members and functions into one type. The guide connects this to encapsulation: object data and operations are kept together, and access is controlled with private, protected and public members.
An abstract data type describes the logical behavior of data and operations. C++ classes can implement ADTs by exposing operations while hiding storage details.
1.7 Identifying Classes, Objects And Operations
In object-oriented design, identify the objects in the problem, list the data each object must store, then list the operations that act on that data.
Memory hook: Nouns often suggest objects; verbs often suggest operations.
Iterators provide a general way to step through container elements. This matters because the same algorithmic idea can work across multiple container types.
Exam trap: Do not assume every container behaves like an array. Some containers are better traversed through iterators than direct indexes.
Linked lists use nodes connected by pointers. They avoid the fixed-size and data-movement limits of arrays, but they must be traversed through links.
NodesPointersInsertionDeletion
3.1 Linked Lists
A linked list is a collection of nodes. Each node stores data and a link to the next node; the first node is accessed through a separate pointer such as head or first.
Insertion and deletion are done by changing links. The core discipline is to preserve access to the rest of the list before rerouting pointers.
Common failure: If you overwrite the only pointer to the next node before saving it, the remaining nodes are lost.
3.3 Linked List As An ADT
The linked list ADT exposes operations such as checking whether the list is empty, traversal, insertion and deletion. The user should not have to manage each pointer manually.
3.7 Doubly Linked Lists
A doubly linked list stores links in both directions. This supports backward movement, but every insert or delete must maintain both the forward and backward links.
Recursion is a problem-solving technique that reduces a problem to smaller versions of itself.
Base caseGeneral caseRecursive function
4.1 Recursive Definitions
A recursive definition has a base case that gives a direct answer and a general case that expresses the answer in terms of a smaller version of the problem.
4.2 Problem Solving Using Recursion
Recursive algorithms work well when the problem naturally breaks into smaller copies, such as factorial, recursive list processing and tree traversal.
int sumTo(int n) {
if (n == 0)
return 0;
return n + sumTo(n - 1);
}
4.3 Recursion Or Iteration?
Iteration repeats with loops; recursion repeats by function calls. The guide points out that some problems are easier recursively, while others can be more efficient or clearer with loops.
A stack is a Last In First Out structure. The guide connects stacks to function calls, recursive calls, postfix expression evaluation and removing recursion.
LIFOpushtoppop
5.1 Stacks
A stack adds and removes elements only at the top. The last element pushed is the first one popped.
top: C
B
bottom: A
push(D) places D above C. pop() removes the current top item only.
5.2 Linked Implementation Of Stacks
A linked stack stores stack elements in nodes. The top pointer identifies the node that will be read or removed next.
5.4 Application: Postfix Expressions
Stacks are useful for expression processing because operands can be pushed and operators can pop the most recent operands in the required order.
5.6 Removing Recursion
The guide uses stacks as a way to replace some recursive processes with nonrecursive algorithms, especially when calls need to be remembered and processed later.
A queue is a First In First Out structure. Items are added at the rear and deleted from the front.
FIFOfrontrearsimulation
6.1 Queue Operations
The queue operations in the guide include initializeQueue, isEmptyQueue, isFullQueue, front, back, addQueue and deleteQueue.
front: A
B
C
rear: D
6.2 Implementation Of Queues As Arrays
An array-based queue needs indexes for the front and rear. Because insertion and deletion happen at different ends, careful index movement is essential.
6.3 Linked Implementation Of Queues
A linked queue uses nodes and maintains pointers to both the first and last nodes so that deletion from the front and insertion at the rear can be handled cleanly.
6.4 Priority Queues
A priority queue processes items according to priority rather than plain arrival order. This connects later to heaps and sorting discussions.
Searching determines whether an item exists, where it is located, or where it should be inserted or deleted.
Sequential searchBinary searchHashingChaining
7.2 Sequential Search
Sequential search starts at the first element and continues until the item is found or the entire list has been searched. It does not require the list to be ordered.
for (int i = 0; i < length; i++) {
if (list[i] == item)
return i;
}
return -1;
7.4 Binary Search
Binary search uses divide and conquer on an ordered list. It compares the search item with the middle element, then continues in the half where the item could exist.
int first = 0;
int last = length - 1;
while (first <= last) {
int mid = (first + last) / 2;
if (list[mid] == item)
return mid;
if (item < list[mid])
last = mid - 1;
else
first = mid + 1;
}
7.6 Hashing
Hashing uses a hash function to compute an address in a hash table. The guide describes hashing as an average-order-one search approach when data is organized with a hash table.
Exam trap: Hashing is not comparison based. You must explain the role of the hash function and how collisions are handled.
7.8 Chaining
Chaining is one way to organize data when multiple keys map to the same hash location. The table can store pointers to linked lists of matching bucket entries.
The guide compares common sorting algorithms and studies their performance. Sorting may apply to array-based lists or linked lists depending on the algorithm.
8.2 Insertion Sort
Insertion sort divides the array into a sorted upper portion and an unsorted lower portion. The first unsorted element is moved into its correct place in the sorted portion.
for (int firstOutOfOrder = 1; firstOutOfOrder < length; firstOutOfOrder++) {
if (list[firstOutOfOrder] < list[firstOutOfOrder - 1]) {
elemType temp = list[firstOutOfOrder];
int location = firstOutOfOrder;
do {
list[location] = list[location - 1];
location--;
} while (location > 0 && list[location - 1] > temp);
list[location] = temp;
}
}
8.4 Mergesort
Mergesort is included for linked list-based lists. The key idea is to divide the list and merge sorted parts back together.
8.5 Heapsort And Priority Queues
Heapsort connects sorting to heap-based structure. The chapter also revisits priority queues, where the next item is chosen by priority rather than simple position.
Trees organize data dynamically so insertion, deletion and lookup can be more efficient than plain sequential structures.
Binary treeTraversalBSTAVLB-tree
9.1 Binary Trees
A binary tree is either empty or has a root node and two binary subtrees called the left subtree and right subtree.
Root
Left subtree
Right subtree
9.2 Binary Tree Traversal
Traversal visits every node. The order matters: preorder, inorder and postorder place the root visit at different points in the left-root-right sequence.
Traversal
Order
Preorder
Root, left, right.
Inorder
Left, root, right.
Postorder
Left, right, root.
9.3 Binary Search Trees
A binary search tree stores values so that smaller values are reached through the left subtree and larger values through the right subtree, supporting efficient search when balanced.
9.7 AVL Trees And Rotations
AVL trees are height-balanced trees. Rotations repair imbalance after insertion or deletion so the tree does not degrade into a long chain.
Graphs model relationships using vertices and edges. The guide introduces graph terminology, representation, traversal, shortest path, minimum spanning trees and topological order.
VerticesEdgesDFSBFSDijkstra
10.2 Graph Definitions And Notations
A graph G = (V, E) has a finite nonempty set of vertices and a set of edges. If the edges are ordered pairs, the graph is directed; otherwise, it is undirected.
A
B
C
A-B, B-C, A-C
10.4 Graphs As ADTs
A graph ADT can hide the storage representation while exposing operations such as creating a graph, printing it and traversing it.
10.5 Graph Traversals
Graph traversal is more complex than tree traversal because graphs may contain cycles and may not be connected. The guide uses a visited array to prevent repeated visits.
visited[v] = true;
for each vertex u adjacent to v
if (!visited[u])
traverse from u;
10.6 Shortest Path Algorithm
For weighted graphs, the guide introduces Dijkstra's shortest path algorithm. Starting from a source vertex, it repeatedly chooses the closest unsettled vertex and updates distances through that vertex.
Exam trap: Shortest path uses edge weights; ordinary graph traversal order alone does not prove a weighted shortest path.