Medium · O((V + E) log V)
Dijkstra's Algorithm quiz
Pick an answer to see whether it's right, and why. Nothing is saved or sent.
Question 1 of 10
- Question 1: current
- Question 2: not answered yet
- Question 3: not answered yet
- Question 4: not answered yet
- Question 5: not answered yet
- Question 6: not answered yet
- Question 7: not answered yet
- Question 8: not answered yet
- Question 9: not answered yet
- Question 10: not answered yet
A directed graph with 6 vertices and these edges (from → to, weight): 0→1 (7), 0→2 (2), 2→1 (3), 1→3 (1), 2→3 (8), 3→4 (2), 2→4 (9). Vertex 5 has no edges. After dijkstra(graph, 0), what is dist[4] and which path does shortestPath give for target 4?
Take it further
- AnimationPathfinding
Pathfinding Maze
An editable neon maze where BFS, Dijkstra, A* and greedy search race to the goal, step by step
Free
