mid2solns - CMPS 101 Summer 2009 Midterm Exam 2 Solutions...

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

View Full Document Right Arrow Icon
CMPS 101 Summer 2009 Midterm Exam 2 Solutions 1. (20 Points) Let G be a directed graph. Determine whether, at any point during a Depth First Search of G , there can exist an edge of the following kind. No justification is required. (See last page for DFS pseudocode.) a. (4 points) A tree edge which joins a gray vertex to a black vertex. Yes b. (4 Points) A tree edge which joins a black vertex to a white vertex. No c. (4 Points) A back edge which joins a black vertex to a gray vertex. Yes d. (4 Points) A forward edge which joins a white vertex to a gray vertex. No e. (4 Points) A cross edge which joins a gray vertex to a white vertex. No 2. (20 Points) Trace Depth First Search (DFS) on the directed graph G below. Process the vertices in numerical order in line 5 of DFS, and line 3 of DFS-VISIT. (See the last page for DFS pseudocode.) 1 4 7 2 5 8 9 3 6 10 a. (5 Points) Fill in the following table of discovery and finish times. Draw the depth-first forest. Vertex
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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

mid2solns - CMPS 101 Summer 2009 Midterm Exam 2 Solutions...

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

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