dv pv
0 0 -
1 3 2
2 2 0
3 3 0
4 8 5
5 7 1
public init[] calculateIndegrees (ListNode L[]) {
int n = L.length;
int ind[] = new [n];
for (int i=0; i<n; i++) // initialize indegree array
ind[i] = 0;
for (int i=0; i<n; i++) { // examine each list
ListNode curr = L[i];
while (curr != null) {
ind[curr.destination]++;
curr = curr.next;
} // while
} // i
} // calculateIndegrees
Cost = 26
Edges = (0,1), (1,2), (1,5), (2,6), (3,8), (4,5), (4,8), (5,7)
dv pv Cost = 26 (should match cost of Kruskal's algorithm)
0 3 1
1 2 2
2 2 6
3 8 8
4 3 5
5 1 1
6 0 -
7 3 5
8 4 4
Cost = 33
Offspring: 0 4 6 7 1 2 3 5
6 1 2 3 0 4 7 5
Subset of a set that adds up to 0.
Example: { 4, 6, -3, -2, 1, 9}. Yes. { 4, -3, -2, 1}
Answer "yes" or "no", not find best solution.
Nodes are NP-complete problems.
Directed Edges show reduction of one problem to another
Example: Hamiltonian Cycle can be reduced to TSP