Data Structures & AlgorithmsHardICPC regional · GATE CS top band

Complete undirected graph on vertices A to E with symmetric edge weights given row by row (row i, column j = weight of edge between vertices i and j, with A = row 0): 0 4 14 8 4; 4 0 12 7 4; 14 12 0 5 4; 8 7 5 0 9; 4 4 4 9 0. A tour visits every vertex exactly once and returns to the start. What is the minimum total weight of such a tour?

  1. A. 47
  2. B. 34
  3. C. 25
  4. D. 24

Correct answer: D. 24

Brute force over all 24 orders of the remaining vertices gives a minimum of 24. The greedy nearest-neighbour tour gives 25, and the largest tour weight 47 is a maximisation mistake.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic