Reasoning about Algorithms November 21, 2015 Rice University COMP 382, Fall 2015

Reasoning about Algorithms
Rice University
Swarat Chaudhuri
November 21, 2015
COMP 382, Fall 2015
Homework 6
Homework 6 – Due Thursday, December 3, 2015
Please refer to the course website for the full homework policy and options.
• Your solutions are due in class. Please also submit a soft copy on Owlspace.
• Collaboration is permitted, but you must write the solutions by yourself without assistance,
and be ready to explain them orally to a member of the course staff if asked. You must also
identify your collaborators. Getting solutions from outside sources such as the Web or students
not enrolled in the class is strictly forbidden.
• To facilitate grading, please write down your solution to each problem on a separate sheet of
paper. Make sure to include all identifying information and your collaborators on each sheet.
• When in doubt, email the TAs or the instructor.
• For problems that require you to provide an algorithm, you must give a precise description of
the algorithm, together with a correctness argument and an analysis of its running time. You
may use algorithms from class as subroutines. You may also use any facts that we proved in
1. (Efficient recruiting) Suppose you are helping organize a summer camp. The camp is supposed
to have at least one counselor who is skilled at each of the n sports covered by the camp (baseball,
volleyball, and so on). They have received job applicants from m potential counselors. For each
of the n sports, there is a subset of the m applicants qualified in that sport. The question is:
For a given number k < m, is it possible to hire at most k of the counselors and have at least
one counselor qualified in each of the k sports? We’ll call this the Efficient Recruiting Problem.
Show that Efficient Recruiting is NP-complete.
2. (Zero-weight-cycle) You are given a directed graph G = (V, E) with weights we on its edges
e ∈ E. The weights can be negative or positive. The Zero-Weight-Cycle Problem is to decide if
there is a simple cycle in G so that the sum of the edge weights in this cycle is exactly 0. Prove
that this problem is NP-complete.
3. (Feedback set) Given an undirected graph G = (V, E), a feedback set is a set X ⊆ V with
the property that G − X has no cycles. The Undirected Feedback Set Problem asks: Given G
and k, does G contain a feedback set of size at most k? Prove that Undirected Feedback Set is
4. (Randomized auction) Suppose you are designing strategies for selling items on an auction
website. The site uses a one-pass auction, where every bid must be immedately (and irrevocably)
accepted or refused. The site works like this:
• First a seller puts up an item for sale.
• Then buyers appear in sequence.
• When buyer i appears, he or she makes a bid bi > 0.
• The seller must decide immediately whether to accept the bid or not. If the seller accepts
the bid, the item is sold and all future buyers are turned away. If the seller rejects the
bid, buyer i departs and the bid is withdrawn; and only then does the seller see any future
Suppose an item is offered for sale, and there are n buyers, each with a distinct bid. Suppose
further that the buyers appear in a random order, and that the seller knows the number n of
buyers. We would like to design a strategy which gives the seller a reasonable chance of accepting
the highest of the n bids. By a strategy, we mean a rule by which the seller decides whether to
accept each presented bid, based only on the value of n and the sequence of bids seen so far.
For example, the seller could always accept the first bid. This results in the seller accepting the
highest of the n bids with probability only 1/n, as it requires the highest bid to be the one first
Give a strategy under which the seller accepts the highest of the n bids with probability at least
1/4, regardless of the value of n. (For simplicity, you may assume that n is an even number.)
Prove that your strategy achieves this probabilistic guarantee.
5. (Randomized coloring) Let us consider the following variant of the problem of 3-coloring a
graph. We are given a graph G = (V, E) and we want to color each node with one of three
colors, even if we aren’t necessarily able to give different colors to every pair of adjacent nodes.
Instead, we say that an edge (u, v) is satisfied if the colors assigned to u and v are different, and
seek to maximize the number of satisfied edges.
Consider a 3-coloring that maximizes the number of satisfied edges, and let c∗ denote this
number. Give a polynomial-time randomized algorithm for our problem where the expected
number of satisfied edges is at least 23 c∗ .