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

Lesson 6-1 · When Fewest Steps Isn't Fastest — Knowledge Checks

Name Date
  1. Why does compute_bfs_path() choose the slow road without hesitation?

    1. A.It has a bug
    2. B.It counts steps, and the slow road is one step like any other — the graph has no way to say an edge is long
    3. C.It prefers rows to columns
    4. D.It always chooses the first neighbor in the list

    Answer Why?

  2. A normal block takes 4 seconds and the slow segment takes 16. What is its weight?

    1. A.16
    2. B.4 — it costs four normal blocks' worth of time
    3. C.12
    4. D.0.25

    Answer Why?

  3. With the slow segment at weight 5, which route does BFS choose from (0,0) to (0,3), and what does it cost?

    1. A.Route B, cost 5 — BFS finds the cheapest path
    2. B.Route A, cost 7 — BFS finds the fewest steps, and A has 3 steps to B's 5
    3. C.Route A, cost 3
    4. D.Neither; it reports no path

    Answer Why?

  4. The slow segment measures weight 3. From (0,0) to (0,3), what happens?

    1. A.The detour is faster by 2
    2. B.The straight route costs 1+3+1 = 5 and the detour costs 5 — a tie, so the slow road is not slow enough to change the answer
    3. C.The straight route is faster by 2
    4. D.BFS reports no path

    Answer Why?