Mixed Practice - Shortest Paths

You've learned BFS, Dijkstra, Bellman-Ford, and Floyd-Warshall. Now practice mixing them together.

36 lessons
100 min

Lessons

1. Intro

(Choosing the right algorithm)

3m

2. The Decision Tree

(Four questions to ask)

3m

3. Quiz: Algorithm Selection

Knowledge check

2m1 problems

4. When BFS Wins

(Unweighted graphs only)

3m

5. When Dijkstra Wins

(Non-negative weights)

3m

6. Quiz: Dijkstra Traps

Knowledge check

2m1 problems

7. When Bellman-Ford Wins

(Negative weights allowed)

3m

8. Negative Cycles: The Trap

(Not always infinite)

3m

9. Quiz: Negative Cycles

Knowledge check

2m1 problems

10. When Floyd-Warshall Wins

(All-pairs, small graphs)

3m

11. CSES 1671 Shortest Routes I - Problem Statement

(CSES - Dijkstra)

3m1 problems

12. CSES 1671 Shortest Routes I - Recognizing Dijkstra

(Single-source, non-negative)

3m

13. CSES 1671 Shortest Routes I - Implementation Notes

(Priority queue tricks)

3m

14. Quiz: Dijkstra Optimization

Knowledge check

2m1 problems

15. CSES 1671 Shortest Routes I - Implementation

(C++ code)

3m1 problems

16. CSES 1673 High Score - Problem Statement

(CSES - Bellman-Ford trap)

3m1 problems

17. CSES 1673 High Score - The Maximum-Score Trick

(Negate and minimize)

3m

18. CSES 1673 High Score - The Reachability Trap

(Not all cycles matter)

3m

19. Quiz: Negative Cycle Impact

Knowledge check

2m1 problems

20. CSES 1673 High Score - Implementation

(Bellman-Ford + BFS)

3m1 problems

21. CSES 1195 Flight Discount - Problem Statement

(CSES - State-space Dijkstra)

3m1 problems

22. CSES 1195 Flight Discount - State-Space Graphs

(Tracking coupon usage)

3m

23. CSES 1195 Flight Discount - Transitions

(Two types of edges)

3m

24. Quiz: State Graph Size

Knowledge check

2m1 problems

25. CSES 1195 Flight Discount - Implementation

(State Dijkstra)

3m1 problems

26. CSES 1202 Investigation - Problem Statement

(CSES - Dijkstra + counting)

3m1 problems

27. CSES 1202 Investigation - Counting During Dijkstra

(Four arrays)

3m

28. CSES 1202 Investigation - Update Rules

(When relaxing u→v)

3m

29. Quiz: Counting Paths

Knowledge check

2m1 problems

30. CSES 1202 Investigation - Implementation

(Extended Dijkstra)

3m1 problems

31. Codeforces 295B Greg and Graph - Problem Statement

Codeforces 295B - Reverse F...

3m1 problems

32. Codeforces 295B Greg and Graph - The Reverse Trick

(Process deletions backward)

3m

33. Codeforces 295B Greg and Graph - Floyd-Warshall Incremental

(Adding one node at a time)

3m

34. Quiz: Reverse Processing

Knowledge check

2m1 problems

35. Codeforces 295B Greg and Graph - Implementation

(Reverse Floyd-Warshall)

3m1 problems

36. Section Recap

(What you practiced)

3m

Practice Problems

1.
String ProblemCodeforceseasy
2.
Shortest PathCodeforcesmedium
3.
Buy a TicketCodeforcesmedium
4.
Run for beerCodeforceshard
5.
Three StatesCodeforceshard
6.
Meeting HerCodeforceshard
7.
FlightsCodeforceshard

Ready to start learning?

Access all 36 lessons with interactive content and progress tracking.