Data Structures & AlgorithmsHardGATE CS · ICPC regional

Complete undirected graph on vertices A to E 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 5 7 10; 12 0 12 9 10; 5 12 0 10 13; 7 9 10 0 4; 10 10 13 4 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. 38
  2. B. 41
  3. C. 48
  4. D. 54

Correct answer: A. 38

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic