DSA
    advanced

    Dijkstra's Algorithm

    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.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 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