hw6solns - CMPS 101 Summer 2009 Homework Assignment 6...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPS 101 Summer 2009 Homework Assignment 6 Solutions 1. (1 Point) p.551: 22.4-1 Show the ordering of vertices produced by TOPOLOGICAL-SORT when it is run on the dag of Figure 22.8, under the assumption of Exercise 22.3-2. Solution: Vertex Adjacency List Discover Time Finish Time m q r x 1 20 n o q u 21 26 o r s v 22 25 p o s z 27 28 q t 2 5 r u y 6 19 s r 23 24 t 3 4 u t 7 8 v w x 10 17 w z 11 14 x 15 16 y v 9 18 z 12 13 A topological sort of the vertices is obtained by ordering them by decreasing finish time: p n o s m r y v x w z u q t /// m t q u n x p o r w v y z s
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. (1 Point) p.557: 22.5-2 Show how the procedure STRONGLY-CONNECTED-COMPONENTS works on the graph of Figure 22.6. Specifically, show the finishing times computed in line 1 and the forest produced in line 3. Assume that the loop of lines 5-7 of DFS considers vertices in alphabetical order and that the adjacency lists are in alphabetical order. Solution: The first call to DFS was traced in problem 22.3-2, which is problem 2 of hw6, and the finish times are given in the solutions to hw6. We order the vertices by decreasing finish times from that call, then run DFS a second time on the transposed graph below. Vertex
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/03/2009 for the course CS CS101 taught by Professor Agoreback during the Spring '09 term at American College of Gastroenterology.

Page1 / 4

hw6solns - CMPS 101 Summer 2009 Homework Assignment 6...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online