
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Kruskal; Class: Algorithms; Subject: Computer Science; University: University of Maryland; Term: Summer I 2008;
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Summer 2008 CMSC 351: Homework 9 Clyde Kruskal
Due at the start of class Friday, July 11, 2008.
Problem 1. Let G = (V, E) be a directed graph.
(a) Assuming that G is represented by an adjacency matrix A[1..n, 1 ..n], give a Θ(n^2 )-time algorithm to compute the adjacency list representation of G. (Rep- resent the addition of an element v to a list l using pseudocode by l ← l ∪ {v}.) (b) Assuming that G is represented by an adjacency list Adj[1..n], give a Θ(n^2 )-time algorithm to compute the adjacency matrix of G.
Problem 2. Do Exercise B.5-5 on page 1091 of CLRS.
Problem 3. Do Exercise 24.3-1 on page 600 of CLRS.
Problem 4. Give a simple example of a directed graph with negative weight edges, but no negative weight cycles, for which Dijkstra’s algorithm produces incorrect answers.
Problem 5.
(a) What is the (optimization version of the) Longest Acyclic Path Problem? (b) What is the decision version of the Longest Acyclic Path Problem? (c) Show that the decision version of the Longest Acyclic Path Problem is in NP.