comp360_hw4sol

comp360_hw4sol - Problem 1 We define our supermarket...

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

View Full Document Right Arrow Icon
Problem 1 We define our supermarket problem as an NP problem: Problem : SUPER Input : A list of customers, and the items they have purchased, and an integer l. Question : Is there a subset S of customers of size l such that no two customers in S have bought the same item? First, we note that this problem is indeed in NP. If there is such a subset of customers, then the subset itself is our certificate. We simply go through the items each customer has purchased, and if check that there are no duplicates. This takes O (number of items). We will show that SUPER is NP-complete. First, we select a problem known to be NP-complete, the Independent Set problem: Problem : IND SET Input : A graph G = ( V , E ), integer k . Question : Is there a subset S of k vertices so that no two vertices in S share an edge? To show SUPER is NP-complete, we reduce any instance of IND SET to an instance of SUPER, in polynomial time. Reduction : Given a graph G and integer k as input to IND SET, we create an instance of SUPER as follows: For each vertex in G , create a customer in SUPER. For each edge in G create an item in SUPER. A customer has bought an item if and only if its corresponding vertex is incident to the item's corresponding edge. Let l = k . e.g. Customers Items bought 1 1,2,3 2 1 3 4 4 2 5 3,4,5 6 5 Clearly this can be done in polynomial time. We can do this by a Breadth First Search. Note that we are getting a very special case of the SUPER problem, with each item being bought by
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 12/02/2009 for the course COMP COMP 360 taught by Professor Perkins during the Winter '03 term at McGill.

Page1 / 4

comp360_hw4sol - Problem 1 We define our supermarket...

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