Data Structures & AlgorithmsHardGATE CS · ICPC regional · Product Company SDE

In the undirected graph with edges A–B:4, A–C:9, B–D:8, B–E:10, E–F:2, C–D:4, F–A:8, E–D:11, what is the shortest-path distance from A to C?

  1. A. 9
  2. B. 14
  3. C. 13
  4. D. 7

Correct answer: A. 9

Run Dijkstra from A: A=0, B=4, C=9, D=12, E=10, F=8. The fewest-edge path (BFS) is not necessarily the lightest.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic