DSA
advanced
Dijkstra's Algorithm
A popular algorithm for finding the shortest path between nodes in a graph. It handles weighted edges and guarantees the shortest path for non-negative weights.
Dijkstra's Algorithm
⏱ O((V+E) log V)
💾 O(V)
Ready
Speed:50%
Priority Queue (Min-Heap)
Next:
Empty
← Min distance
Always extract node with minimum distance first (greedy choice)
Ready to start
Start
Target
Visited
Shortest Path
Wall
Settle the closest node
Sequence
Order one iteration of Dijkstra’s algorithm with a priority queue.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
5 pieces left to place
Test your knowledge
20 questions
Question 1 of 20
Score: 0
What happens if edge weights are negative?
When to reach for this
- Shortest Path in a **Weighted Graph** (non-negative weights)
- Network Routing Protocols (e.g., OSPF)
- Finding the cheapest cost to reach a destination
Interview Questions
Uber
Lyft
Meta
Google
Amazon
Microsoft
Bloomberg
Airbnb
LinkedIn
Meta
Bloomberg
Microsoft
Google
Amazon
Netflix
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required