From Pin to Pin
This video presents the same text shown beside it, spoken and on screen. It adds nothing the text does not say.
One route request exercises this entire unit: a real question becomes a model, the model chooses structures, the structures host algorithms, the algorithms carry measured costs, and theory stands behind the whole exchange certifying which questions can be answered at all.
A rider drops two pins and asks for the fastest way. The city becomes a problem model (0120): intersections and roads kept, weather and scenery erased — someone's judgment call, working as intended. The model lands in a graph (0101): vertices for intersections, weighted edges for travel times, and that modeling decision was the hard work. Underneath, structures divide the labor by their contracts (0095): a map (0099) binds street names to vertices, an array list (0103) holds each vertex's neighbors for one-step access, a search tree (0107) keeps the place-name index findable, and a priority queue (0110) feeds the route algorithm its next-closest intersection. The shortest path problem (0153) is the formal shape of the rider's question, and the algorithm answering it is greed with a proof (0138, 0152's lesson traveling): always extend the cheapest known route, provably safe here. Every piece was chosen by count (0125) and named by growth (0128): the sorted index pays merge sort's O(N log N) once (0145) so binary search can answer in O(log N) forever after (0144), and the whole route computation stays polynomial — class P (0161), the tractable side of the street. One block over sits longest path (0164), the same map and a question no known algorithm answers efficiently — the boundary of the neighborhood, drawn by theory. The rider sees none of it: a line on a screen, in under a second, resting on every idea this unit numbered.
Later units change the machines, the languages, and the storage under this picture; the ideas in it hold still.
Builds on
- 0092 Algorithm and Program
- 0095 The Abstract Data Type
- 0099 The Map
- 0101 The Graph
- 0103 The Array List
- 0107 The Binary Search Tree
- 0110 The Binary Heap
- 0120 The Problem Model
- 0125 Counting Steps
- 0128 Big O Notation
- 0135 Divide and Conquer
- 0138 The Greedy Method
- 0144 Binary Search, Measured
- 0145 Merge Sort, Run to the Floor
- 0152 The Minimum Spanning Tree
- 0153 The Shortest Path
- 0161 The Class P
- 0164 NP-Completeness