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 1 1 15 11 11; 1 0 13 6 9 12; 1 13 0 6 13 8; 15 6 6 0 11 9; 11 9 13 11 0 14; 11 12 8 9 14 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. 56
  2. B. 46
  3. C. 75
  4. D. 39

Correct answer: D. 39

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic