Skip to main content
Module 6 · Dijkstra's Algorithm (optional)

Lesson 6-4 · Drive It — Knowledge Checks

Name Date
  1. How much of the driving code changes between the BFS run and the Dijkstra run?

    1. A.drive_path() needs a weight parameter
    2. B.None of it — the planner returns a list of intersections either way, and drive_path() drives lists
    3. C.turn_to() has to know about the slow segment
    4. D.track_to_intersection() runs slower on purpose

    Answer Why?

  2. 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?

    1. A.No — more steps must take more time
    2. B.Yes — 5 normal blocks is about 20 s; 2 normal blocks plus a weight-5 segment is about 28 s
    3. C.No — BFS should always be faster
    4. D.Only if the battery was changed between runs

    Answer Why?

  3. Both runs produce the same path and the same time. What is the most likely cause?

    1. A.Dijkstra is broken
    2. B.SLOW_SEGMENT was not typed in (or its weight is 3 or less), so the two planners have no reason to disagree
    3. C.The robot is too fast
    4. D.drive_path() ignores the planner

    Answer Why?