Docsity

Algorithm Design and Analysis - Solved Assignment | CSE 202, Assignments of Computer Science

Toggle sidebar
bg1
Design and Analysis of Algorithms
Flow Problems and NP-Completeness
Homework IV: Turn in the solutions to problems 11 and 14 on June 8th, 2000 in class. No late or early
submissions.
1. Problem 27-1, Page 625 (CLR)
2. Problem 27-2, Page 626 (CLR)
3. Problem 27-5, Page 627 (CLR)
4. Edge-disjoint paths
aGiven an undirected graph
G
=
V; E
and two distinguished nodes,
s
and
t
, describe an algorithm
that finds a maximum-sized set of edge-disjoint paths from
s
to
t
. (We say that two paths are
edge
,
disjoint
if they don’t share a common edge, even though they are allowed to go through
the same vertex.) Give a time analysis for your algorithm in terms of
j
V
j
and
j
E
j
.
bGiven a solution to (a), suppose we add one more edge to the graph. Givean efficient algorithm for
updating the solution. Give a time analysis for your algorithm in terms of
j
V
j
and
j
E
j
. (Your
algorithm should be significantly faster than redoing the entire problem from scratch.)
5. Row-Column sums
Problem You are asked to fill the entries of an
n
n
matrix by integers between 0 and a bound
k
,so
that the sum of all entries in each row, and each column, comes to one of 2
n
numbers given in
advance. For example, the following instance
0
B
@
17 5 4
6 ? ? ?
9 ? ? ?
11 ? ? ?
1
C
A
with
k
=9
has solution
0
B
@
17 5 4
6 6 0 0
9 2 3 4
11 9 2 0
1
C
A
Formulate and solve this problem as a flow problem.
6. Name Job Assignment
1
pf3

Partial preview of the text

Download Algorithm Design and Analysis - Solved Assignment | CSE 202 and more Assignments Computer Science in PDF only on Docsity!

Design and Analysis of Algorithms

Flow Problems and NP-Completeness

Homework IV: Turn in the solutions to problems 11 and 14 on June 8th, 2000 in class. No late or early submissions.

  1. Problem 27-1, Page 625 (CLR)
  2. Problem 27-2, Page 626 (CLR)
  3. Problem 27-5, Page 627 (CLR)
  4. Edge-disjoint paths a Given an undirected graph G = V ; E and two distinguished nodes, s and t, describe an algorithm that finds a maximum-sized set of edge-disjoint paths from s to t. (We say that two paths are edg e disj oint if they don’t share a common edge, even though they are allowed to go through the same vertex.) Give a time analysis for your algorithm in terms of jV j and jE j. b Given a solution to (a), suppose we add one more edge to the graph. Give an efficient algorithm for updating the solution. Give a time analysis for your algorithm in terms of jV j and jE j. (Your algorithm should be significantly faster than redoing the entire problem from scratch.)
  5. Row-Column sums Problem You are asked to fill the entries of an n  n matrix by integers between 0 and a bound k , so that the sum of all entries in each row, and each column, comes to one of 2n numbers given in advance. For example, the following instance

B@

17 5 4 6??? 9??? 11???

CA

with k = 9 has solution

B@

17 5 4 6 6 0 0 9 2 3 4 11 9 2 0

CA

Formulate and solve this problem as a flow problem.

  1. Name Job Assignment

Problem You are given a set of n jobs and a set of m machines. For each job you are given a list of machines capable of performing the job. An assignment specifies for each job one of the machines capable of performing it. The overhead for an assignment is the maximum number of jobs performed by the same machine. The job assignment problem is: given such lists and an integer 1  k  n, is there an assignment with overhead at most k?

  1. Suppose we have a feasible flow x such that, for some nonnegative number K , there is no x-augmenting path of x-width greater than K. Prove that fx (s) is within K m of the maximum value of a feasible flow. (Hint: How would you show this for K = 0 ?) m is the number of edges in the graph.
  2. Suppose that the augmenting paht algorithm always chooses an augmenting path having as few reverse edges as possible. Prove that the number of augmentations will be O (mn). Give an O (m) algorithm for finding such augmentation.
  3. An approach to improving the augmenting path algorithm is to choose at each step an augmenting path of maximum x-width. Give a good bound on the number of augmentations. How efficiently can an augmenting path of maximum x-width be found?
  4. Given a bipartite graph G = (V ; E ) and an integer dv for each node v , does there exist a spanning subgraph H of G such that each node has degree dv in H. Give a good algorithm to answer this question, and also necessary and sufficient conditions for the existence of such a subgraph. A spanning subgraph of G = (V ; E ) is a subgraph whose vertex set is V and whose edge set is a subset of E.
  5. Projects 1 ; 2 ; : : : ; k are available to be undertaken. With each project i is associated a positive revenue ri. Each project i requires a set Si of resources to be available, and each resource j , 1  j  l , has an associated cost cj. However if j is purchased, it is available for any projects for which it is required. Give an algorithm to choose a set of projects so that the associated revenue minus the cost of the required resources is maximized.
  6. Problem 36-1, Page 961 (CLR)
  7. Problem 36-2, Page 962 (CLR)
  8. Problem 37-1, Page 983 (CLR)
  9. Problem 37-2, Page 984 (CLR)
  10. The maximum coverage problem is the following: Given a universe U of n elements, with nonnegative weights specified, a collection of subsets of U , S 1 ; : : : ; Sl , and an integer k , pick k sets so as to maximize the weight of elements covered. Show that the obvious algorithms, of greedily picking the best set in each iteration until k sets are picked, achieves an approximation factor of (1 (1 1 =k )k^ ) > (1 1 =e).
  11. Consider the following variant of metric TSP: given vertices u; v 2 V , find a minimum cost simple path from u to v that visits all vertices. First give a factor 2 approximation algorithm for this problem, and then improve it to factor 3/2.
  12. Give a factor 2 approximation algorithm for the following problem: Given a directed graph G = (V ; E ) with nonnegative edge costs, and a partitioning of V into two sets Senders and Receivers, find a minimum cost subgraph such that every Receiver vertex has a path to a Sender vertex.