When is self.graph built?
- A.The first time you call compute_path
- B.Automatically in __init__, when the object is created
- C.You must call build_graph yourself after creating the object
- D.Every time you access it
Answer Why?
What does `if (row, col) in self.blocked: continue` do?
- A.Adds the node with an empty neighbor list
- B.Skips a blocked node so it never becomes a key in the graph
- C.Stops the whole loop
- D.Marks the node as visited
Answer Why?
Why leave compute_path as a placeholder for now?
- A.Because the algorithm is impossible
- B.To test the class structure (constructor and graph) first, before adding the harder algorithm next lesson
- C.To save memory
- D.It will never be implemented
Answer Why?
On a 4×4 grid, how many nodes does Dijkstra((0,0), [(1,0),(2,1)]).graph contain?
- A.16
- B.15
- C.14
- D.2
Answer Why?
Why does it matter that Dijkstra's compute_path returns the same type as Manhattan's?
- A.It makes the code run faster
- B.The Navigator can use either class interchangeably, since it just calls compute_path and gets a list of tuples back
- C.It saves disk space
- D.It doesn't matter
Answer Why?