2023 Spring Solution
2023 Spring Solution
Exam 2
INSTRUCTIONS
• The duration of the exam is 140 minutes, closed book and notes.
• No space other than the pages on the exam booklet will be scanned
for grading!
• If you require an additional page for a question, you can use the extra
page provided at the end of this booklet. However please indicate
clearly that you are continuing the solution on the additional page.
1
1. True/False Questions (10 points)
Mark the following statements as T or F. No need to provide any
justification.
2
True
h) T/F If a problem is NP-hard, it is also N P -complete.
False. If the solution can be verified in polynomial time, only
then
i) T/F A 1.01-approximation vertex cover algorithm must find the
optimal solution for graph with vertices less than 100
True. ALG ≤ 1.01OPT < OPT + 1
j) T/F To solve bin packing with a first-fit approach, items must
be first sorted in order to get a constant approximation.
False. The first-fit approach is 2-approximation algorithm.
3
2. Multiple Choice Questions (20 points)
Please select the most appropriate choice. Each multiple choice ques-
tion has a single correct answer.
4
d) If f is a maximum s − t flow in a flow network, then for all
edges out of s are saturated.
a)
d) Let X be a problem that belongs to the class N P . Which one of
the following is true?
a) X cannot be solved deterministically in polynomial time.
b) If X can be solved deterministically in polynomial time, then
P = NP .
c) X may be undecidable.
d) X can be solved in nondeterministic polynomial time.
d)
e) Which of the following statements is true?
a) If X and Y are reducible to each other, then X and Y are
N P -Complete.
b) If X and Y are N P -Complete, then X and Y are reducible to
each other.
c) N P -Hard is a subset of N P -Complete.
d) 2-SAT problem is N P -Complete.
b)
f) Let X, Y, Z be the problems which can be solved in time O(log n),
O(n3 ), O(2n ) respectively (where n denotes the input size). Then,
we can NOT conclude that
a) Y is reducible to X.
b) Y is reducible to Z.
c) Z is reducible to Y .
d) If Z is reducible to Y , then Z is reducible to X.
c)
g) Consider the linear program
5
max(31x + 55y)
subject to:
2x − y ≤ 80
y≥x
x≥0
y≥0
Which of the following statement(s) are true?
a) the linear program has a single optimal solution.
b) the linear program has infinitely many optimal solutions.
c) the linear program has no optimum solution.
c)
h) What is the feasible region in linear programming?
a) The set of all optimal solutions to the LP problem
b) The feasible region is the set of all feasible solutions that satisfy
the constraints of the LP problem.
c) The set of all feasible solutions that satisfy the objective func-
tion
d) The set of all solutions that satisfy the objective function
b). The feasible region is the set of all feasible solutions that
satisfy the constraints of the LP problem. It is the common re-
gion determined by all the constraints in the linear programming
problem.
i) Consider a linear program having an objective max cT x, and let
its dual have the objective min bT y. Let x and y be some feasible
solutions of the primal and dual respectively. Then,
a) cT x ≥ bT y.
6
b) cT x ≤ bT y.
c) cT x = bT y.
d) Any definitive comparison for the objectives is not possible.
b)
j) A feasible solution of Linear Programming
a) Must satisfy all the constraints.
b) Does not need satisfy all the constraints, but only some of
them.
c) Must be a corner point of the feasible region.
d) Must be the maximum of the objective function.
a)
7
3. Linear Programming (15 points)
A company produces three products, Product X, Product Y, and Prod-
uct Z. The company has a limited amount of resources, including pro-
duction time, labor, and materials. The goal is to maximize profits
subject to resource constraints. The following information is available:
solution:
8
a) Let x be the number of units of Product X to produce, y be the
number of units of Product Y to produce, and z be the number
of units of Product Z to produce.
b) The objective function to maximize profits can be expressed as:
9
Figure 0.1: Question 4
10
a)
b)
c) No, a feasible solution does not exist. Because the max-flow ver-
sion of the problem has a max flow of 9, which is less than the
sum of positive demands in the circulation problem w/o lower
bounds.
11
5. NP Completeness (20 points)
An organization is arranging an event spread over n days, namely
D1 , D2 , . . . , Dn , and needs volunteers to manage the event. On day
i, at least vi volunteers are needed. A total of m people, namely
P1 , P2 , . . . , Pm , have applied to volunteer with each applicant indicates
the availability. An applicant, if selected, must work on all the days
that he or she has indicated. The organization wants to select as few
volunteers as possible. Please complete the following five questions.
12
b) Construction: We have a graph G = (V, E) as an input to the
VC problem.
- For each edge e in E, we construct a day De . (1 point)
- For each node v in V, we construct an applicant Pv . (1 point)
- Each applicant is available for all the days(edges) incident on
the corresponding vertex (equivalently, for each day De where
e = (u, v), only the two applicants Pu and Pv are available). (1.5
points)
- vi for each day Di is simply 1. (1.5 points)
The construction is done trivially in polynomial time.
c) Claim: VC instance has a vertex cover of size at mostk, if Event
Management can be done with at most k volunteers.
d) If the event management can select at most k applicants, we pick
the vertices corresponding to these applicants. Since for each
edge at least 1 applicant available that day was chosen, the cor-
responding vertex covers that edge, thus, the k vertices cover all
the selected nodes.
e) If the VC instance has a cover of size k, we simply select the
applicants corresponding to these nodes. For each day, we have
satisfied its requirement of 1 volunteer since the corresponding
edge is covered by at least one of the selected k vertices.
13
e) 3 points if correct, provided part b) is also correct, else zero.
14
6. Approximation Algorithm (15 points)
There are N products with infinite supply available and the price of
each one of product i is pi , 1 ≤ pi ≤ 100. You have a $100 gift card,
and to better utilize it, you try to buy a bunch of products to maximize
the total value, subject to the limit $100. For example, if there are 3
products with prices $49.99, $89.99, $50, then the optimal solution is
to buy two product 3, and the total value is $100.
a) Suppose every price is more than 50, that is, for every i we have
50 < pi ≤ 100. Prove that you can find the optimal solution in
O(N ) time. (4 points)
b) Suppose there exists a price no more than 50, that is, there exists
an i so that 1 ≤ pi ≤ 50. Prove that buying ⌊100/pi ⌋ product
i alone is a 32 -approximation algorithm. Here ⌊x⌋ is the greatest
integer less than or equal to x, for example, when pi = 30, you
buy ⌊100/30⌋ = 3 product i. (6 points)
c) Without the assumptions in a) and b), design a 23 -approximation
algorithm that runs in O(N ). Prove your results. (5 points)
a) Since every price is more than 50, we can only buy one product
with amount 1.Thus, the optimal solution is buying one product
with the highest price, which can be found in O(N ) time.
b) We consider two cases: pi > 100 100 100
3 or pi ≤ 3 . If pi > 3 , we have
⌊100/pi ⌋ = 2 as 3pi > 100 and 2pi ≤ 100 by the assumption that
pi ≤ 50. Therefore, the approximation ratio is
2pi 2pi 200/3 2
≥ ≥ = .
OPT 100 100 3
15
On the other hand, by the definition of the floor function, we have
16
if the wrong algorithm in a) is used; no deduction for using the
approximation in b) even if the proof in b) is missing or wrong
17
Additional space
18
Additional space
19