Q. How does Dijkstra's algorithm handle nodes that have already been visited?
-
A.
It ignores them
-
B.
It re-evaluates their distances
-
C.
It adds them to a stack
-
D.
It removes them from the graph
Solution
Once a node has been visited and its shortest distance determined, Dijkstra's algorithm ignores it in future iterations.
Correct Answer:
A
— It ignores them
Learn More →
Q. Which of the following is NOT a step in Dijkstra's algorithm?
-
A.
Initialize distances
-
B.
Select the node with the smallest distance
-
C.
Update distances of adjacent nodes
-
D.
Sort the entire graph
Solution
Dijkstra's algorithm does not require sorting the entire graph; it focuses on updating distances based on the selected node.
Correct Answer:
D
— Sort the entire graph
Learn More →
Showing 1 to 2 of 2 (1 Pages)