🎙 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 5 of 10

How many rounds of "relax every edge" does Bellman-Ford need for V nodes (without the check round)?

How many rounds of "relax every edge" does Bellman-Ford need for V nodes (without the check round)?

  1. A.V
  2. B.E
  3. C.log V
  4. D.V − 1
Answer & explanation

Correct answer: V − 1

A shortest simple path has at most V − 1 edges, and each round fixes at least one more of them.

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 →