Question: Consider 4 locations, numbered 0 , 1 , 2 , and 3 . The following table shows the distances between the locations . 0 1
Consider locations, numbered and The following table shows the distances between the locationsThere exist circuits that visit each location exactly once. However these circuits do notall have the same length. For example, the following two circuits differ in length: and back to with length and back to with length For this simple example, it is not hard to see that the shortest circuit length is However, ifwe increase the number of locations, it gets harder to determine the length of the optimal circuit.The first line of the input of this problem contains a positive integer n which is the number oflocations. You may assume that n is at most The next n lines contain the distance matrix.Because the distances are symmetric, only half the matrix is given. The output of the programmust be the length of the shortest circuit that visits all locations.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
