QB2 - Graph

QB2 - Graph - COMP 271 Design and Analysis of Algorithms...

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: COMP 271 Design and Analysis of Algorithms 2004 Fall Semester Question Bank 2 Solving these questions will give you good practice for the midterm. Some of these ques- tions (or similar ones) will definitely appear on your exam! Note that you do not have to submit answers to these questions for grading. Your TAs will discuss answers to selected questions in the tutorials. 1 Basic Graph Problems 1. Given an undirected graph G = ( V, E ), recall that the complement , G , is a graph ( V, E ′ ) such that for all u negationslash = v , { u, v } ∈ E ′ if and only if { u, v } / ∈ E . Prove that either G or G is connected. 2. When a vertex and its incident edges are removed from a tree, a collection of subtrees remains. Design a linear-time algorithm that, given a tree with n vertices, finds a vertex whose removal leaves no subtree with more than n/ 2 vertices. 2 Breadth-First Search and Depth-First Search 1. The adjacency list representation of a graph G , which has 7 vertices and 10 edges, is: a : → d, e, b, g b : → e, c, a c : → f, e, b, d d : → c, a, f e : → a, c, b f : → d, c g : → a a d e b c f g (a) Show the tree produced by depth-first search when it is run on the graph G , using vertex a as the source. You must use the adjacency list representation given above. (Recall that the DFS tree can depend on the order of vertices in the adjacency lists; for this problem you are required to use the adjacency lists as given above.) 1 (b) In the DFS tree of item (a), show the edges of the graph...
View Full Document

This note was uploaded on 10/18/2009 for the course COMP 271 taught by Professor Arya during the Spring '07 term at HKUST.

Page1 / 3

QB2 - Graph - COMP 271 Design and Analysis of Algorithms...

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