CSE331 HW4 - might be two kinds of edges: i.e., it might be...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 331: Introduction to Algorithm Analysis and Design Fall 2011 Homework 4 Due Friday, October 7, 2011 by 1:15pm in class IMPORTANT: Please submit each problem separately, i.e. each problem should begin on a new page and only the pages for one problem should be stapled together. Failure to do so might result in some problem(s) not being graded. For general homework policies and our suggestions, please see the policy document. Do NOT submit the last problem. It will not be graded. However, we highly encourage you to think about the problem to get more comfortable with graphs. 1. (40 points ) Exercise 2 in Chapter 3. 2. (45 points ) Exercise 4 in Chapter 3. ( Hint : It might be useful to represent the input as a graph and run one of the connectivity algorithms we have seen in class. Also in one way of representing the “relationships,” there
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: might be two kinds of edges: i.e., it might be useful to label the edges. As usual, feel free to ignore this hint and come up with an algorithm from scratch.) 3. (15 points ) Exercise 8 in Chapter 3. 4. ( Do NOT turn this problem in ) Given a directed graph G = ( V,E ), a vertex s V is called a sink if there are incoming edges from every other vertex to s but no outgoing edge from s , i.e. |{ ( u,s ) E }| = | V | -1 and |{ ( s,u ) E }| = 0. As a warmup present an O ( n 2 ) algorithm to nd out if G has a sink and if so, to output it. (Recall that n = | V | ). Now present an O ( n ) time algorithm for the same problem. 1...
View Full Document

This note was uploaded on 12/11/2011 for the course CSE 331 taught by Professor Rudra during the Fall '11 term at SUNY Buffalo.

Ask a homework question - tutors are online