CS FundamentalsHardProduct-company MCQ pattern

An undirected network has links A–B 4, A–C 1, B–C 2, B–D 5, C–D 8, C–E 10, D–E 2, D–F 6, E–F 3. What is the cost of the shortest path from A to F found by Dijkstra's algorithm?

  1. A. 14
  2. B. 15
  3. C. 13
  4. D. 10

Correct answer: C. 13

Dijkstra from A: C = 1, B = min(4, 1 + 2) = 3, D = min(3 + 5, 1 + 8) = 8, E = min(1 + 10, 8 + 2) = 10, F = min(8 + 6, 10 + 3) = 13 along A–C–B–D–E–F. 14 is A–B–D–E–F (missing the cheaper route to B through C), 15 is A–C–D–F, and 10 is the distance to E, not F.

More Computer Networks questions

Exams that ask this topic