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

In 0-1 BFS, after relaxing an edge of weight 0 to node v, where is v pushed?

In 0-1 BFS, after relaxing an edge of weight 0 to node v, where is v pushed?

  1. A.To the back of the deque
  2. B.Into a min-heap
  3. C.To the front of the deque
  4. D.Nowhere; weight-0 edges are skipped
Answer & explanation

Correct answer: To the front of the deque

A weight-0 edge does not increase the distance, so v belongs with the nodes being processed now, at the front.

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 →