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 12 8 7 13 8; 12 0 9 8 12 13; 8 9 0 3 8 2; 7 8 3 0 11 5; 13 12 8 11 0 12; 8 13 2 5 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. 55
  2. B. 60
  3. C. 45
  4. D. 48

Correct answer: C. 45

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic