← Quiz: Shortest Paths: all 10 questions
Quiz: Shortest Paths · Question 9 of 10
A city map has non-negative travel times on 10⁵ roads. Which algorithm fits best?
A city map has non-negative travel times on 10⁵ roads. Which algorithm fits best?
- A.Bellman-Ford
- B.Floyd-Warshall
- C.Dijkstra with a min-heap
- D.Plain BFS
Answer & explanation
Correct answer: Dijkstra with a min-heap
Non-negative weights and a large graph: Dijkstra's O((V + E) log V) is the right choice.
Can you get the rest right without peeking?
Take the timed Quiz: Shortest Paths quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →