Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2

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 9 6 13 9 9; 9 0 12 7 8 12; 6 12 0 12 2 12; 13 7 12 0 5 15; 9 8 2 5 0 2; 9 12 12 15 2 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. 69
  2. B. 41
  3. C. 42
  4. D. 49

Correct answer: B. 41

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic