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 8 7 14 14 8; 8 0 2 14 4 10; 7 2 0 10 10 13; 14 14 10 0 13 11; 14 4 10 13 0 12; 8 10 13 11 12 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. 45
  3. C. 50
  4. D. 75

Correct answer: B. 45

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic