Lesson 6-4 · Drive It — Knowledge ChecksAnswer key
How much of the driving code changes between the BFS run and the Dijkstra run?
The plan-versus-drive split from Lesson 4-0 pays off a third time. The driving functions never knew what a path meant, so a path chosen for cost instead of steps is just another list.
A team's Dijkstra run takes 5 steps and 21 seconds; their BFS run takes 3 steps and 29 seconds. A normal block is about 4 seconds. Do the numbers make sense?
Cost predicts time: 5 blocks' worth against 7 blocks' worth, at about 4 seconds a block. The stopwatch agreeing with the cost column is the point of the lesson.
Both runs produce the same path and the same time. What is the most likely cause?
The printed plans before the button show this at once. With no slow edge, or a weight that ties with the detour, Dijkstra and BFS agree — as they should.