This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: McGill University COMP251: Assignment 4 Worth 10%. Due November 12 at the beginning of lecture (10am sharp!) Note For this assignment, you can simply say “insert (an element) x into (a linked list) L ” without having to give the details of how it is implemented. Question 1 For both parts below, draw the graph with direction of the edges clearly marked, and write down for each vertex the adjacency list of its neighbors. If your graph has n vertices, then they are numbered 1 to n , and this is the order in which the DFS algorithm loops through the vertices in the main forloop. (a) Give a counterexample to the conjecture that if a directed graph G contains a path from u to v , and if s [ u ] < s [ v ] in a DFS of G , then v is a descendant of u in the DFS forest. (b) Give an example of a vertex u in a directed graph G such that u has both incoming and outgoing edges, and u belongs to the DFS tree that contains only u ....
View
Full
Document
This note was uploaded on 11/05/2009 for the course COMP COMP 251 taught by Professor Phuongnguyen during the Fall '09 term at McGill.
 Fall '09
 PhuongNguyen
 Algorithms, Data Structures

Click to edit the document details