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

Info icon This 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
Image of page 1

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

View Full Document Right 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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern