Recall & Review
beginner
What is the main goal of Dijkstra's Algorithm?
To find the shortest path from a single starting point (source) to all other points (vertices) in a graph with non-negative edge weights.
Click to reveal answer
intermediate
In Dijkstra's Algorithm, what data structure is commonly used to select the next vertex with the smallest tentative distance?
A priority queue (often implemented as a min-heap) is used to efficiently pick the vertex with the smallest current distance estimate.
Click to reveal answer
intermediate
Why can't Dijkstra's Algorithm handle graphs with negative edge weights?
Because it assumes that once a vertex's shortest distance is found, it won't change. Negative edges can create shorter paths later, breaking this assumption.
Click to reveal answer
advanced
What is the time complexity of Dijkstra's Algorithm using a min-heap and adjacency list?
O((V + E) log V), where V is the number of vertices and E is the number of edges.
Click to reveal answer
beginner
Explain the relaxation step in Dijkstra's Algorithm.
Relaxation means checking if the current known distance to a neighbor can be improved by going through the current vertex. If yes, update the neighbor's distance.
Click to reveal answer
What type of graph edge weights does Dijkstra's Algorithm require?
✗ Incorrect
Dijkstra's Algorithm only works correctly with non-negative edge weights.
Which data structure helps efficiently pick the next vertex with the smallest distance in Dijkstra's Algorithm?
✗ Incorrect
A priority queue (min-heap) is used to select the vertex with the smallest tentative distance efficiently.
What happens during the relaxation step in Dijkstra's Algorithm?
✗ Incorrect
Relaxation updates the distance to neighbors if a shorter path through the current vertex is found.
What is the initial distance to the source vertex in Dijkstra's Algorithm?
✗ Incorrect
The source vertex distance is set to zero because the distance from the source to itself is zero.
What is the worst-case time complexity of Dijkstra's Algorithm using a simple array instead of a priority queue?
✗ Incorrect
Using a simple array to find the minimum distance vertex leads to O(V^2) time complexity.
Describe the main steps of Dijkstra's Algorithm for finding the shortest path from a source vertex.
Think about how distances are updated and how the next vertex is chosen.
You got /5 concepts.
Explain why Dijkstra's Algorithm does not work with graphs containing negative edge weights.
Consider what happens if a shorter path appears after a vertex is finalized.
You got /4 concepts.