Skip to main content
Module 5 · Dijkstra's Algorithm

Lesson 3 · Dijkstra's Algorithm — The Concept — Knowledge Checks

Name Date
  1. What does the previous dictionary store?

    1. A.The distance from the start to each node
    2. B.Which node you came from to reach each node — used to rebuild the path
    3. C.The list of blocked nodes
    4. D.How many neighbors each node has

    Answer Why?

  2. Which unvisited node does Dijkstra visit next?

    1. A.The one closest to the destination
    2. B.The one with the smallest known distance from the start
    3. C.The most recently updated one
    4. D.A random one

    Answer Why?

  3. At step 7, visiting (2,1) offers (2,2) a distance of 3+1=4, but (2,2) already has distance 4. What happens?

    1. A.(2,2) is updated to 4 again
    2. B.No change — the new distance is not smaller than the existing one
    3. C.The algorithm crashes
    4. D.(2,2) is marked visited early

    Answer Why?

  4. Why must the reconstructed path be reversed?

    1. A.To make it look nicer
    2. B.Because tracing previous goes from destination back to start — reversing puts it in start-to-destination order
    3. C.Dijkstra always returns paths backward by mistake
    4. D.It doesn't need to be reversed

    Answer Why?

  5. On a clear grid with no obstacles, how does Dijkstra's path length compare to Manhattan's?

    1. A.Always shorter
    2. B.The same length (the exact route may differ)
    3. C.Always longer
    4. D.Unpredictable

    Answer Why?