When he reached Chapter 7—Graph Algorithms—the PDF transformed his dorm room into a glowing city map. Nodes were street intersections. Edges were roads with weights (traffic times). A voice—calm, measured, vaguely Canadian—said: “You are at node S. The hospital is at node T. An ambulance needs the shortest path. Dijkstra’s algorithm initializes with distance[S]=0, all others ∞.”
“To the worthy reader: solve the first exercise correctly, and the book will open fully. Solve none, and you will see only the index. Time is O(n²).” “This is insane
He got a 98. The two points he lost were for forgetting to write his name. opened a fresh can of Monster
Leo had to step through the algorithm by moving his cursor to unvisited nodes, relaxing edges, and updating distances. If he made a mistake, a digital pothole opened and his cursor fell through, resetting the problem. and began to type.
“This is insane,” Leo muttered. But he was also desperate. He cracked his knuckles, opened a fresh can of Monster, and began to type.