Unit: Data Structures, Graph Algorithms, and Shortest Paths (Computing, Grade 10)
Unreviewed AI draft. Written by Gemini 4 Argon (2026-11-05). No human teacher has reviewed this unit. All content is CC0 1.0 Public Domain.
Overview
Why can a web browser undo your last ten actions instantly, a dictionary look up one word out of 100,000 in a single step instead of scanning from A to Z, and a transit map find the fastest route across a city in milliseconds? The answer is not just faster hardware—it is choosing the right data structure and algorithm for the problem.
Across five 50-minute lessons (runnable either completely unplugged with index cards and dry-erase tables or alongside a Python 3 interpreter), Grade 10 students trace, compare, and analyze four foundational data structures and two graph-search algorithms: stacks (LIFO) and queues (FIFO), hash tables with modulo bucket indexing and collision chains, graphs represented as adjacency matrices and adjacency lists, Breadth-First Search (BFS) for unweighted fewest-hop routing, and Dijkstra's algorithm for weighted shortest paths. Throughout the unit, students count exact operations rather than relying on hand-wavy speed claims, building concrete intuition for constant-time (O(1)) vs. linear-time (O(n)) cost.
Prior knowledge
- Students can trace step-by-step algorithms with loops and conditionals (Inputs, outputs, loops, and debugging, Grade 3), understand packet routing and binary representation (Binary, pixels, logic gates, and packet switching, Grade 6), and compute integer division remainders (for example,
29 ÷ 7 = 4 with remainder 1, written 29 mod 7 = 1).
- Helpful cross-links:
- Ratios and proportional reasoning (Mathematics, Grade 6) and Proportional relationships (Mathematics, Grade 7) for load factors (
items / buckets) and linear operation scaling.
- Ecology field sampling (Science, Grade 10) for modeling habitat patches and wildlife corridors as nodes and weighted edges.
- Leads to: Grades 11–12 cryptography, network security, and software engineering in the Computing & systems progression.
Learning goals
By the end of this unit, a student can:
- Trace sequences of
PUSH/POP operations on a stack (LIFO) and ENQUEUE/DEQUEUE operations on a queue (FIFO), and select which structure correctly models undo history, bracket matching, or print/packet scheduling (Lesson 1).
- Compute bucket indices using a deterministic hash function and the modulo operator (
h(k) mod M), resolve bucket collisions using separate chaining, and compare worst-case linear scan (n comparisons) against average-case hash lookup (1 + α comparisons, where α = n / M) (Lesson 2).
- Represent a directed or undirected graph
G = (V, E) as both an adjacency matrix and an adjacency list, and compare their memory cost and edge-lookup speed on sparse vs. dense networks (Lesson 3).
- Execute Breadth-First Search (BFS) step by step using a FIFO queue and a
visited set (plus parent pointers) to find the shortest unweighted path (fewest hops) between two vertices (Lesson 4).
- Execute Dijkstra's algorithm on a non-negative weighted graph using a tentative distance table (
dist[], prev[], settled), and explain with a counterexample why fewest hops does not always equal minimum total weight (Lesson 5).
Lesson sequence
| Lesson |
Title |
Time |
Core idea |
| Lesson 1 |
Who Goes Next? Stacks (LIFO), Queues (FIFO), and Operation Cost |
50 min |
Stacks reverse arrival order (Last-In, First-Out); queues preserve arrival order (First-In, First-Out) |
| Lesson 2 |
Finding Needles Without Scanning the Haystack: Hash Tables and Collisions |
50 min |
A hash function turns a key into an array bucket index (O(1) average lookup); chaining handles two keys landing in the same bucket |
| Lesson 3 |
Modeling Networks: Graphs, Adjacency Lists, and Adjacency Matrices |
50 min |
A graph models entities (vertices) and relationships (edges); adjacency lists save memory on sparse graphs |
| Lesson 4 |
Expanding Ripples: Breadth-First Search (BFS) and Fewest-Hop Routing |
50 min |
BFS uses a FIFO queue to explore vertices layer by layer (0, 1, 2... hops), guaranteeing the shortest unweighted path |
| Lesson 5 |
Weighted Routes: Dijkstra's Shortest-Path Algorithm |
50 min |
When edges have non-negative costs (minutes, kilometers, latency), Dijkstra's algorithm greedily settles the closest unvisited vertex and relaxes its outgoing edges |
Materials for the whole unit
- Paper, pencils, and 10 index cards per pair of students (for physical stack/queue traces and hash bucket chains)
- Printed or hand-drawn 6-vertex and 7-vertex graph worksheets (diagrams included in ASCII/table form inside Lessons 3–5)
- Optional: Python 3 interpreter (standard library
collections.deque and heapq) if running in a computer lab
Assessment summary
Each lesson concludes with a 3-question exit check with complete worked solutions and step-by-step state tables. Lesson 5 includes an end-of-unit synthesis problem where students compare BFS vs. Dijkstra on a 6-node regional network and trace the full distance/predecessor table.
Sources
These references provide standard computer science definitions and algorithmic background for teachers. All links were checked to load on 2026-11-05.
- Data structure (overview of trade-offs between memory layout and operation cost): https://en.wikipedia.org/wiki/Data_structure — background for Lessons 1–3.
- Stack (abstract data type — LIFO
push/pop semantics and call/undo stacks): https://en.wikipedia.org/wiki/Stack_(abstract_data_type) — background for Lesson 1.
- Queue (abstract data type — FIFO
enqueue/dequeue semantics and buffering): https://en.wikipedia.org/wiki/Queue_(abstract_data_type) — background for Lessons 1 and 4.
- Hash table (hash functions, load factor, and separate chaining collision resolution): https://en.wikipedia.org/wiki/Hash_table — background for Lesson 2.
- Graph (abstract data type — vertices, edges, adjacency lists, and adjacency matrices): https://en.wikipedia.org/wiki/Graph_(abstract_data_type) — background for Lesson 3.
- Breadth-first search (queue-based layer traversal and unweighted shortest paths): https://en.wikipedia.org/wiki/Breadth-first_search — background for Lesson 4.
- Dijkstra, E. W. (1959), A note on two problems in connexion with graphs, via Wikipedia summary of Dijkstra's algorithm: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm — background for Lesson 5.
Known gaps and cautions
- Unreviewed AI draft: This unit has not yet been reviewed by a human high-school computer science educator or classroom-tested with Grade 10 students. (Peer-checked by Claude Haiku 5.5 on Lessons 2 and 5, and by Claude Fable 5.2 on Lessons 1, 3, and 4 with trace tables, bracket expressions, matrices, and numerical answers checked via script and Lesson 4 closing check 1 checked by reading; all 6 notes resolved.)
- Asymptotic Big-O notation introduced via exact step counts: Rather than starting with formal limit definitions of
O(1), O(n), and O(V + E), Lessons 1–4 first have students count exact array accesses and comparisons for concrete inputs (n = 8, n = 1,000) and then introduce Big-O as a shorthand for how step count scales as n grows.
- Toy vs. cryptographic hash functions (Lesson 2): Lesson 2 uses a small arithmetic hash function (
sum of letter positions mod 7) so students can compute bucket indices by hand in 10 seconds. Explicitly remind students that this toy hash is not a cryptographic hash (like SHA-256, deferred to Grade 11) and is deliberately chosen to produce collisions that students can resolve via chaining.
- Negative edge weights in Dijkstra's algorithm (Lesson 5): Dijkstra's greedy settlement rule requires all edge weights to be non-negative (
w >= 0). Lesson 5 includes a concrete 3-vertex counterexample showing how a negative edge breaks Dijkstra's settled assumption (which requires Bellman–Ford).