Question: Write more detailed version of Dynamic programming algorithm for the traveling salesperson problem (Algorithm 3.11). Hint: One design decision is how to store the subsets

Write more detailed version of Dynamic programming algorithm for the traveling salesperson problem (Algorithm 3.11).

Hint: One design decision is how to store the subsets of vertices. This can be done, for example, with an array of n linked lists, each of them holding the set of vertices (from zero empty set to (n 2) sets) and the respective optimal cost and j vertex associated. (write the pseudocode and to implement it in Java)

Write more detailed version of Dynamic programming algorithm for the traveling salesperson

Algorithm 3.11 The Dynamic Programming Algorithm for the Traveling Salesperson Problem Problem: Determine an optimal tour in a weighted, directed graph. The weights are nonnegative numbers. Inputs: a weighted, directed graph, and n, the number of vertices in the graph. The graph is represented by a two-dimensional array W, which has both its rows and columns indexed from 1 to n, where W [1] ) is the weight on the edge from ith vertex to the jth vertex. Outputs: a variable minlength, whose value is the length of an optimal tour, and a two-dimensional array P from which an optimal tour can be constructed. P has its rows indexed from 1 to n and its columns indexed by all subsets of V - {01}. Pl [A] is the index of the first vertex after vi on a shortest path from v; to v that passes through all the vertices in A exactly once. public static number travel (int n, number (0) W index P) { index i, j, ki number minlength; number O) D = new number 1..n] [ subset of V - {}]; for (i = 2; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!