DDSA Solutions

Shortest Path

12 problems · 8 with full explanations

0 Easy6 Medium2 Hard
Shortest path algorithms find minimum-cost routes in graphs. Dijkstra (non-negative weights, O((V+E) log V)), Bellman-Ford (negative edges, O(VE)), Floyd-Warshall (all-pairs, O(V³)), and BFS (unweighted, O(V+E)). In C#, use PriorityQueue for Dijkstra.

How to practice

To practice Shortest Path problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the shortest path pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.

Open the full study guide →

All Shortest Path problems