← Quiz: Closures and Warshall's Algorithm: all 10 questions
Quiz: Closures and Warshall's Algorithm · Question 6 of 10
What is the Warshall update rule from Wₖ₋₁ to Wₖ?
What is the Warshall update rule from Wₖ₋₁ to Wₖ?
- A.Wₖ[i][j] = Wₖ₋₁[i][k] AND Wₖ₋₁[k][j]
- B.Wₖ[i][j] = Wₖ₋₁[j][i]
- C.Wₖ[i][j] = Wₖ₋₁[i][j] AND Wₖ₋₁[k][k]
- D.Wₖ[i][j] = Wₖ₋₁[i][j] OR (Wₖ₋₁[i][k] AND Wₖ₋₁[k][j])
Answer & explanation
Correct answer: Wₖ[i][j] = Wₖ₋₁[i][j] OR (Wₖ₋₁[i][k] AND Wₖ₋₁[k][j])
Keep old paths, and add a path i → k → j that uses k as a middle stop.
Can you get the rest right without peeking?
Take the timed Quiz: Closures and Warshall's Algorithm quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →