INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR
Mid-Autumn Semester 2018-19
Date of Examination:
Session (FN/AN):
Duration: 2 hours
Full Marks: 60
Subject No: CS60007
Subject: ALGORITHM DESIGN AND ANALYSIS
Department/Center/School: COMPUTER SCIENCE AND ENGINEERING
Specific charts, graph paper, log book etc., required: NO
Special instruction (if any): NA
Answer question 5 and any three of the first four questions.
1. [A-perfect r-matching] Let G = (A ∪ B, E) be a bipartite graph. An r-matching of G is a subset
M ⊆ E of edges such that
(a) For each vertex u in A, |{v ∈ B : (u, v) ∈ M}| ∈ {0, r}, i.e., each vertex in A is matched to
either no vertex in B, or exactly r vertices in B,
(b) For each vertex v in B, |{u ∈ A : (u, v) ∈ M}| ∈ {0, 1}, i.e., each vertex in B is matched to
at most one vertex in A.
Note that the usual notion of matching corresponds to r = 1. An r-matching M is said to be
A-perfect if all the vertices in A are matched in M, i.e., for each vertex u in A, |{v ∈ B : (u, v) ∈
M}| = r. Recall that for a subset A 0 ⊆ A, the neighborhood N(A 0 ) of A 0 is defined to be the
set of neighbors of vertices in A 0 , i.e., N(A 0 ) = {v ∈ B : there exists u ∈ A such that (u, v) ∈ E}.
Prove that G has an A-perfect r-matching if and only if for each subset A 0 ⊆ A, |N(A 0 )| > r|A 0 |.
Note that for r = 1, this is Hall’s theorem.
[15 Marks]
2. Let G be an undirected weighted graph. Each edge f in G has a real weight w(f) which
could possibly be negative. Let T1 and T2 be two different minimum spanning trees of G. Let
e = (u, v) be an edge that is in T1 but not in T2 . Let P be the unique path between u and v in
T2 . Show that P has an edge e 0 such that w(e 0 ) = w(e).
[15 Marks]
3. Given two strings x and y of lengths m and n respectively over an alphabet Σ, design an
algorithm with worst case running time O(mn) to find the edit distance between x and y.
The edit distance between any two strings x and y is the minimum number of operations one
needs to perform to transform x into y. The following operations are allowed.
(i) Insertion: any symbol from Σ can be inserted at any position in a string.
(ii) Deletion: any symbol from a string can be deleted.
(iii) Substitution: any symbol from a string can be replaced with another symbol.
[15 Marks]
4. A vertex cover of an undirected graph G = (V, E) is a set of vertices U ⊆ V such that each edge
has one of its endpoints in U, i.e., for each edge (u, v) ∈ E, we have u ∈ U or v ∈ U (or both).
Prove using linear programming duality that if G is bipartite then the size of its maximum
matching is equal to the size of its minimum vertex cover.
[15 Marks]
5. [Hamiltonian path] Let G be an undirected graph with n vertices. A Hamiltonian path of G
is a path which visits each vertex of G exactly once. Design a O(poly(n) · 2n ) time algorithm
to determine if G has a hamiltonian path, and to find a Hamiltonian path in case G has one,
where poly(n) is any polynomial function of n.
[15 Marks]