sol7 - Introduction to Algorithms CS 482, Spring 2008...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Algorithms Solution Set 7 CS 482, Spring 2008 (1) First, we prove that Party Invitation is in NP . There is a polynomial-time verifier that takes an instance I of Party Invitation — consisting of numbers n,k , lists P i (1 i k ), and values m i (1 i k ) — along with a solution S consisting of a list of at most n guests, and outputs “yes” if S is a valid solution of I . To do so, it suffices to initialize a counter to 0 for each housemate, and then process each guest g on the list S , incrementing the counter of each housemate who wants to invite g . Processing a single guest takes O ( k + p ) time where p is the sum of the lengths of the lists P i . Thus the verifier runs in time O ( n ( k + p )). Next, we prove that Party Invitation is NP-hard . In fact Vertex Cover P Party Invitation. The reduction. Given an instance of Vertex Cover consisting of a graph G = ( V,E ) and a parameter q , we construct an instance of Party Invitation in which the housemates are in one-to-one correspondence with the edges of G , and the friends (i.e., potential invites) are in one-to-one correspondence with the vertices of G . Edge e = ( u,v ) corresponds to a housemate i whose list P i consists of exactly two friends, u and v , and whose value m i is equal to 1. The upper bound on the number of friends who may be invited is q . Running time of the reduction. The reduction runs in polynomial time. In fact, if m is the number of edges of G then O ( m ) is the running time of the reduction because the list P i has constant size for each i . If G has a vertex cover of size at most q , then the party invitation instance is solvable. If S is a vertex cover of G and | S | has size at most q , then the vertex set S corresponds to a set of friends in the corresponding Party Invitation instance. Invite this set of friends to the party. This satisfies the upper bound on the total number of friends who may be invited, and for every housemate i at least one of the two friends on the list P i is invited because i corresponds to an edge of G and at least one endpoint of this edge belongs to S . If the party invitation instance is solvable, then
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2008 for the course CS 482 taught by Professor Kleinberg during the Spring '08 term at Cornell University (Engineering School).

Page1 / 4

sol7 - Introduction to Algorithms CS 482, Spring 2008...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online