Problem Set 4

COMP 360: Algorithm Design
Instructor: Yang Cai
Problem Set 4
Due: Apr 1, 2015
General Rules: Follow the collaboration policy. In particular, each of you
should write your own solution even if you have collaborated with your classmates. In solving these questions you may consult books but you may not
search on the web for solutions. You should drop your solutions in the assignment drop-off box located in the Trottier Building. No late assignments
accepted.
1. (10 pts) Backtracking: Vertex Coloring.
We can use the following state-space tree T for a backtracking algorithm to test whether a graph
is 3-colorable. The root node of T gives vertex A color 1. Every node in the tree then has three
children corresponding to each of the three colors. For example, the root has three children that
correspond to giving vertex B the colors 1, 2 and 3 respectively. These three nodes each have three
children corresponding to the color given to node C etc. Apply the backtracking algorithm to test
whether or not the following graph is 3-colorable. [You should also start with the root node A,
order the children alphabetically, and search using DFS order.]
B A C G H D F E 2. (20 pts) Local Search: Load Balancing p704, Qu. 12.4.
3. (10 pts) Given a set P of n points on the plane, consider the problem of finding the smallest circle
containing all the points in P . Show that the following is a 2-factor approximation algorithm for
this problem. Pick a point x ∈ P , and set r to be the distance of the farthest point in P from x.
Output the circle centered at x with radius r.
4. (15 pts)Knapsack:
Let W be the capacity, wi ≤ W be item i’s weight and vi be item i’s value. Consider the following
algorithm.
2-1
(a) Reorder the items according to their values and weights, so that
v2
vn
v1
≥
≥ ··· ≥
.
w1
w2
wn
(b) Pick items in this order until one doesn’t fit, and then halt.
(c) Compare the value of the solution from step (b) and the largest value of a singe item, return
which one is higher (either the solution of step (b) or the largest vi ).
Show that this is a 2-approximation algorithm for the knapsack problem.
5. (20 pts) TSP:
We define two versions of the Traveling Salesman Problem:
• TSP with repetitions (TSP-R): The costs do not necessarily satisfy triangle inequality. Find
a min cost cycle that visits every vertex at least once and returns to the origin, where the
cycle can visit some vertex more than once.
• ∆-TSP: The costs satisfy triangle inequality. Find a min cost cycle that visits every vertex
exactly once and returns to the origin.
Argue that these two versions are equivalent. That is, for every c ≥ 1, there is a polynomial
time c-approximate algorithm for ∆-TSP if and only if there is a polynomial time c-approximate
approximation algorithm for TSP-R.
2-2