CSE 2320 Section 501/571 Fall 1999

Homework 5

Due: December 2, 1999, in class (December 3, 1999, 5:00pm for -10%)

1.
Execute TOPOLOGICAL-SORT on the following graph by labeling the vertices with the starting and finishing times produced by depth-first search, and listing the vertices in topological order. Consider vertices in alphabetic order when iterating over a set of vertices.

2.
Execute STRONGLY-CONNECTED-COMPONENTS on the following graph.

(a)
Label the vertices of the above graph with the starting and finishing times produced by the first call to depth-first search, considering vertices in alphabetic order when iterating over a set of vertices.

(b)
Show the transpose of the above graph.

(c)
Label the transpose graph with the starting and finishing times produced by the second call to depth-first search, considering vertices in the proper order.

(d)
Show the strongly-connected components of the original graph.

3.
Following Figure 24.5 on page 508, execute the MST-PRIM procedure on the following graph and show the final minimum spanning tree. Use vertex a as the root vertex and consider vertices in alphabetical order.

4.
Following Figure 27.6 on page 595, show the execution of the Edmonds-Karp algorithm on the following flow network.

5.
Compute the Knuth-Morris-Pratt prefix function for the following patterns when the alphabet is .

(a)
abccbabbcaabcbabccbabcba

(b)
aaaaaaaabbbbbbbbaaaaaaaa

6.
Determine a possible pattern (if any) consistent with the following KMP prefix functions when the alphabet is .

(a)

 i 1 2 3 4 5 6 7 8 0 1 2 3 0 1 0 1

(b)

 i 1 2 3 4 5 6 7 8 0 1 2 1 2 1 2 1

(c)

 i 1 2 3 4 5 6 7 8 0 0 0 1 1 0 0 0