Solution To CS 5104 Take-Home Quiz
Solution To CS 5104 Take-Home Quiz
Solution To CS 5104 Take-Home Quiz
1. (5 points) Show that the ≤P relation is a transitive relation on languages. That is, show
that if L1 ≤P L2 and L2 ≤P L3, then L1 ≤P L3.
w ∈ L1 ⇔ w′ ∈ L2 ⇔ w′′ ∈ L3
2. (5 points) Fill out the table described in the polynomial time algorithm for context-
free language recognition from Theorem 7.16 for string w = baba and CFG G:
S → RT
R → TR | a
T → TR | b
last symbol
b a b a
b {T} { R, T } {S} { S, R, T }
first a {R} {S} {S}
symbol b {T} { R, T }
a {R}
CS 5104 take-home quiz -2- April 20, 2006
3. (15 points) A subset of the nodes of graph G is a dominating set if every node of G is
either in the subset or is adjacent to some node in the subset. Let
I. DOM-SET ∈ NP
A. Certificate: a set of vertices that dominate G
B. Algorithm: M = “On input 〈G, c〉:
for each vertex v in G
check if v ∈ c or ∃ x ∈ c such that (v, x) is in G
C. Runtime: Polynomial in V[G] + E[G]