Data Structures & AlgorithmsHardCodeforces Div 2 · ICPC regional

Complete undirected graph on vertices A to F 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 7 2 4 13 3; 7 0 15 15 8 7; 2 15 0 12 13 11; 4 15 12 0 15 4; 13 8 13 15 0 15; 3 7 11 4 15 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. 53
  2. B. 67
  3. C. 38
  4. D. 73

Correct answer: C. 38

Brute force over all 120 orders of the remaining vertices gives a minimum of 38. The greedy nearest-neighbour tour gives 53, and the largest tour weight 73 is a maximisation mistake.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic