Let's first formally define the problem:
You will implement two algorithms:
Implementation details:
int[] findPartition (double[][] adjMatrix)Here, the input is a weighted graph represented by an adjacency matrix. A value of zero in the matrix indicates lack of an edge; otherwise the entry is the weight of the edge. The return value is the set of vertices in Set1 (the first partition). Thus, if the method call is made as follows:
int[] set1 = findPartition (adjMatrix);then set1.length is the number of vertices in Set1 and set1[i] is the i-th vertex in the set. Thus, in the optimal solution for the example above, we should expect set1[0]=0, set1[1]=3.
Submission: