a4 - McGill University COMP251: Assignment 4 Worth 10%. Due...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 for-loop. (a) Give a counter-example 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

Page1 / 2

a4 - McGill University COMP251: Assignment 4 Worth 10%. Due...

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