🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Bellman-Ford
  2. B.Floyd-Warshall
  3. C.Dijkstra with a min-heap
  4. 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 →