Homework Spring 2014
 Friday January 10
 Read the syllabus
 Join the class group
 Problem 33 part a. If you aren't able to find a group, you
can do this individually.
 Monday January 13
 Problem 34
 Consider the following definitions for f(n, m) = O(g(n, m)).
State which definitions are logically equivalent. Fully
justify your answers. Argue about which definition you think
is the best one in the context where f and g are run times of
algorithms and the input size is monotonicaly growing in n and
m ( for example n might be the number of vertices in a graph
and m might be the number of edges in a graph).
 there exists positive constants c, n_0, m_0 such that
0<= f(n, m) <= c * g(n, m) for all (n, m) such that n
>= n_0 AND m >= m_0
 there exists positive constants c, n_0, m_0 such that
0<= f(n, m) <= c * g(n, m) for all (n, m) such that n
>= n_0 OR m >= m_0
 There exists a constant c> 0 such that lim sup_{n >
infinity} lim sup_{m > infinity} f(n,m)/g(n, m) < c.
Note that this means that you first take the limit superior
with respect to m. The result will be a function of just n.
You then take the limit superior of this function with
respect to n. If you don't know what limit superior means,
you can just assume that the limit exisists, in which case
the limit and limit superior are the same.
 There exists a constant c> 0 such that lim sup_{m >
infinity} lim sup_{n > infinity} f(n,m)/g(n, m) < c.
Note that on the surface that this definition is different
than the last on in that the order that you take the limits
is switched.
 There exists a constant c> 0 such that for all but
finitely many pairs (m, n) it is the case that f(n,m) < c
* g(n, m)
 Wednesay Janaury 15
 43. For part c use the master method from Lemma 4.4. For
parts d and f use induction. For the rest, expand the
recurrence relation to get a sum over the levels of the
recursive call tree of the time per level as we did in class
for the proof of Lemma 4.4.
 301. This doesn't require any information from chapter 30.
 Part c. Hint: Part a will be useful.
 Give a parralel algorithm for the problem in part c. You
can assume that multiple processors can concurrently
simultaneously read a memory location. Give a recurrence
relation for T(n, p), the time for your algorithm on n bit
numbers with p processors. Expand and solve this
recurrence relation.
 Friday January 17
 Assume you are given a balanced complete binary tree with n
nodes. Explain how to map the nodes to an O( sqrt(n)) by
O(sqrt(n) ) square
grid such that the edges from the tree are mapped to
nonoverlapping axisparallel straight paths in the grid. You
must give a solution using divide and conquer.You will need to
strengthen the induction hypothesis slightly. Write the
resulting recurrence relation for the amount of area used, and
for the total length of the paths in the embedding, and solve
the recurrences.
 Give solutions to the following recurrence relations that
are as accurate as possible, ideally to within in a
multiplicative constant. HINT: Since you only need an
approximate answer when you are done, you can approximate in
your calculations.
 T(n) = T(n  sqrt(n)) + 1 HINT: How many levels until
the input size halves?
 T(n) = T(n  sqrt(n)) + n
 T(n) = T(n  lg n) + 1
 T(n) = T(n  lg n) + lg n
 Wednesday January 22
 8.13 Given an adversarial strategy and prove that it is
correct.
 8.14. Give an adversarial strategy and prove that it is
correct.
 Friday January 24

Problem 86 (for parts c and d, just give an adversarial
strategy, and prove that it works). Explain why the bound that
you get use the method proposed in parts a and b isn't as good
as the bound you get using an adversarial strategy. That is,
in what way are you being too generous to the algorithm in
parts a and b?
 Monday January 27
 Consider the problem of determining whether a collection of
real numbers x_1 ... x_n is nice. A collection of
numbers is nice iff the difference between consecutive
numbers in the sorted order is at most 1. So (1.2, 2.7, 1.8)
is nice, but (1.2, 2.9, 1.8) is not nice since the difference
between 1.8 and 2.9 is more than 1. We want to show that every
comparison based algorithm to detemine if a collection of n
numbers is nice requires Omega(n log n) comparisons of the
form x_i  x_j <= c, where c is some constant that the
algorithm can specify. So if c=0, this is a standard
comparison.
 Hint: This is similar to the lower bound for element
uniqueness.
 Another Hint: Consider the (n1)! permutations pi of {1,
... n} where pi(1)=1, and the corresponding points in n
dimensional space. Note that all (n1)! of these points are
nice. Show the midpoint of any pair of these nice points is
not nice. Then explain how to use this fact to give an
adversarial strategy showing the Omega(n log n) lower bound.
 Show that any comparison based algorithm to compute the
median of n numbers requires 3n/2  O(1) comparisons. Hint:
Appropriately modify the 3n/2  O(1) lower bound for computing
both the maximum and minimum number.
 Wednesday Janaury 29
 Consider a setting where you have two computer networking
routers A and B. Each router has collected a list L_A and L_B
of IP source addresses for the packets that have passed
through the router that day. An IP address is n bits, and thus
there are 2^n possible IP addresses. Now the two routers want
to communicate via a twoway channel to whether there was some
source that sent a packet through one of the routers, but not
the other. So more precisely, at the end of the protocol
each router should commit to a bit specifying the answer to
this question, and the bits for both routers should be
correct. You can assume that a bit sent on the channel is
guaranteed to arrive on the other end in one time unit. We
want to consider protocols for accomplishing this goal.
 Consider the following protocol: A sends to B the
list of all of the IP source addresses that it has
seen, B compares A's list to its list, and then B
sends A a 0 bit if the lists are identical and a 1 bit
otherwise. Show that uses protocol above uses n2^n +1 bits
in the worst case. This is a trivial warmup problem.
 Give a protocol that uses 2^n +O(1) bits in the worst
case. Another trivial warmup problem.
 Show that there is no protocol that can solve this problem
without exchanging any bits. Its obvious that this is true.
That isn't the point. The point is to understand what
arguments you have to make to make this formally correct.
 Show that there is no protocol that can solve this problem
that involves A sending one bit to B. And no more bits are
exchanged. Again its obvious that this is true. Again that
isn't the point. Again the point is to understand what
arguments you have to make to make this formally correct.
Hint: Ask yourself how should the adversarial strategy
should decide whether this first bit is a 0 or a 1?
 Show that there is no protocol that can solve this problem
that involves A sending one bit to B and B replying with one
bit to A. And no more bits are exchanged. Again its
obvious that this is true. Again that isn't the point. Again
the point is to understand what arguments you have to make
to make this formally correct.
 Prove that every protocol for this problem must sent 2^n
bits for its worst case instance. Of course your argument
should involve an adversarial argument.
 Assume that you have a computer networking router that sees
a stream of k IP packets, each with a source IP address. The
router sees a packet, optionally records some information in
memory, and then passes the packet on. The routers's
goal is to always know the IP source address that it has seen
most frequently to date. The most obvoius way to accomplish
this is to keep a count for each IP source address seen to
date. Show that every algorithm must use Omega(k) bits
of memory.
 Hint: This is an "easy" consequence of the previous
subproblem, provided that you think about it the right way.
Assume that you had a method that solved this problem using
o(k) bits of memory. Explain how to use this method to get
an algorithm for the previous subproblem that uses less than
2^k bits of communication.
 Friday January 31
 Assume you are sorting an array of n numbers, where each
permutation is equally likely. Compute the expected total
distance traveled by all the numbers from their starting
position to their ending position. So if the 7th smallest
number started in the 23th position, it will travel 7 
23 = 16 positions. You want to sum up the travel distances
for all the numbers.
 Hint: Use linearity of expectation. This is an easy
warmup exercise.
 McDonalds is running a Monopoly
promotion where every time your order a meal, you get a
random ticket from one of m possible ticket types (there are
essentially infinitely many tickets of each type). Assume (as
is not true in the real promotion) that each of the m tickets
types is equally likely. Calculate as accurately as possible
(at least to within a multiplicative constant) how many
McDonald's meals you would have to eat before you have n
different ticket types for 1 <=n <= m. In particular,
how many meals do you have to eat before you get all m
different ticket types? HINT: Find the Bernoulli trials.
 Monday February 3 There is no class this day.
Email you solution to Michael (mpn1@pitt.edu) by noon.
 Consider the problem of finding the largest i numbers in
sorted order from a list of n numbers (see problem 91) in the
text. Consider the following algorithm: you consider the
numbers one by one, maintaining an auxilary data structure of
the largest i numbers seen to date. We get various algorithms
depending on what the auxillary data structure is and how one
searches and updates it. For each of the following variations
give the worstcase time complexity as a function of n and i.
For each of the following variations give the averagecase
time complexity as a function of n and i under the assumption
that each input permutation is eaully likely. Hint: Use
linearity of expectations. These are all similar and easy if
you look at them the right way.
 The auxillary data structure is an ordered list and you
use linear search starting from the end that contains
the largest number
 The auxillary data structure is an ordered list and you
use linear search starting from the end that contains
the smallest number
 The auillary data structure is a balanced binary search
tree and you use standard log time search, insert and delete
operations
 The auillary data structure is a balanced binary search
tree and you use standard log time insert and delete
operations, but you start your search from the smallest item
in the tree
 This is a multiparter related to computing a random
permutation of an array A of n numbers. Each of the n!
permutation must be output with probability exactly 1/n!.
 Assume you have a source of random bits. So in one time
unit, this source will produce one random bit (that is 1
with probability 1/2 independent of other bits). Show how to
produce a random permutation of an array of n numbers in
expected time O(n log n). This includes both the time that
your algorithm takes, plus 1 unit of time for each random
bit used.
 Hint: This is a pretty easy warmup problem. If your
solution doesn't use an expection of a geometrically
distributed random variable, you might want to rethink.
 Consider the algorithm that repeats the following n^2
times: Pick two indices i and j independently and uniformly
at random, and then swap A[i] and A[j}. Show that this
algorithm does not work.
 Hint: This is easy if you think about it the right way.
You shouldn't have to do any calculations.
 Warm up (don't write up): Why can't you pick one of 3
balls uniformly at random using 3 coin flips?
 Wednesday February 5 There is no class this day.
Email you solution to Michael (mpn1@pitt.edu) by noon.
 Problem 84 from the text. For part b, you must use an
adversary argument, and must write up the explanation in a way
that makes it clear that you understand how an adversary
argument works.
 Assume that you had to solve the hiring problem at a large
academic institution where effectively you couldn't fire
anyone (note that this is a realistic assumption). Thus once
you hire someone, the game is over. Find a strategy that will
hire the best person with probability Omega(1) assuming that
each permutation is equally likely. Try to get this
probability as high as possible. Note that for the purposes of
this problem, hiring the second best person, hiring no one,
and hiring the worst person are all equivalent, the only thing
that matters is hiring the best person. The person hiring
knows n, the number of applicants, a priori.
 HINT: You are pretty limited as to what algorithms are
possible. You basically have to have some rule compares the
new applicant to the previous applicant, and determines
whether this applicant is your hire. There are multiple ways
to analyze this, some are much easier than others. So unless
you are a bit lucky, the first thing you try may not work
easily. 1/e is the best you can do in terms of the
probability you hire the best person.
 HINT: See the discussion of hiring is section 5.1 in the
text
 Friday Februrary 7
 Assume that you have to test n person's blood samples for a
particular disease. One way to accomplish this is to partition
the samples into groups of size k (assume n is evenly
divisible by k). And then test each of the n/k groups using
n/k tests. Each of these tests will tell you whether or not at
least one person in the group has the disease. If at least one
person in the group has the disease, then you need to
individually check each person in the group using k tests.
Assume that each person has the disease with a known
probability p, independent of whether other's have the
disease. Compute the expected number of tests as a function of
n, k, and p. Determine the value of k that minimizes the
expected number of tests, as a function of n and p. Call this
value of k the critical value. Determine the expected number
of tests as a function of n and p at the critical value k. You
may be off by a multiplicative constant in your calculations.
 Hint: Use linearity of expectation and some basic
probability. You will like need to make use of the folowing
facts. If f(k) is increasing in k and g(k) is decreasing in
k, then the minimum of max(f(k), g(k)) occurs when
f(k)=g(k). Max(x, y) and x+y are within a factor of 2 for
positive x and y. ln (1+x) is about x when x is near zero.
 Assume that you have to test n person's blood samples for a
particular disease. You again have group tests telling
whether none or a positive number of people in the group have
the disease. Your goal is to determine for each person
whether they have the disease or not.
 Assume that each person has the disease with a unknown
probability p, independent of whether others have the
disease. Give an algorithm to solve problem where the
expected number of tests is big Oh of the expected number of
tests you computed in the previous problem where p was known
a priori.
 Hint: Use dividing and conquer. If a group tests
positive, split the group into two equal sized subgroups
and recurse.
 Hint: Show that the expected number of tests before you
reach the critical level is big Oh of the number of tests
on the critical level
 Hint: Bound the tail. Show that the expected number of
tests that a person is part of after the critical level is
O(1).
 Assume that an unknown number j of people have the
disease. Give a randomized algoirthm to determine for each
person whether they have the dissease or not. Explain why
you would expect (so I'm looking for an informal discussion,
not a formal proof) that the expected number of tests is
approximately the average number of tests you would expected
for the deterministic divide and conquer algorithm if each
person had the disease with probability p = j/n.
 Monday February 10
 Wednesday February 12
 You have a sorted array A of containing n real numbers each
selected independently and uniformly at random from the
interval [0, 1]. You have an real x in [0, 1]. The problem is
to find a subarray of size sqrt(n) that contains x.
 Show that the following algorithm solves this problem in
O(1) average case time. HINT: Find the Bernoulli
trials. Figure out how to think about the outcome of this
algorithm in terms of the number of successes/failures in
some Bernoulli trials. Use a Chernoff tail bound. See
appendix C.5 or here.
HINT: You can use the result of exercise C.56 without
proof.
 last= x*n
 if A[last] < x then
 next= last + sqrt(n)
 while A[next] < x do
 last=next
 next= next + sqrt(n)
 else if A[last] > x
 next= last  sqrt(n)
 while A[next] > x d0
 last=next
 next= next  sqrt(n)
 Return x lies between positions next and last
 Explain how to use the above algorithm to obtain an
algorithm with O(log log n) average case running time for
the searching problem (finding the exact location of x in
A).
 Friday February 14
 The purpose of this problem is to develop a version of Yao's
technique for Monte Carlo randomized algorithms, within the
context of the jug problem. Consider the red and blue jug
problem from problem 84 in the text. Assume that if you
sorted the jugs by volume, that each permutation is equally
likely.
 Show that if a deterministic algorithm A
always stops in o(n log n) steps, then the probability
that A is correct for large n is less than 1 percent.
 Show if there is a distribution of the input on which no
deterministic algorithm with running time A(n) is correct
with probability > 1 percent, then there is no Monte
Carlo algorithm with running time A(n) that can be correct
with probability > 1 percent. Hint: Mimic the proof of
Yao's technique/lemma for the case of Las Vegas algorithms.
Consider a two dimensional table/matrix T, where entry T(A,
I) is 1 if algorithm A is correct on input I, and 0
otherwise.
 Conclude that any Monte Carlo algorithm for this jug
problem must have time complexity Omega(n log n).
 Monday February 17
 Consider the following online problem. You given a sequence
of bits b_1, ... b_n over time. Each bit is in an envelope.
You first see the envelope for b_1, then the envelope for b_2,
.... When you get the i^th envelope, you can either look
inside to see the bit, or destroy the envelope (in which case
you will never know what the bit is). You know a priori
that at least n/2+1 of the bits are 1. You goal is to find an
envelope containing a 1 bit. You want to open as few envelopes
as possible.
 Give a deterministic algorithm that will open at most n/2
+ O(1)envelopes. HINT: This is completely straightforward.
 Show that every deterministic algorithm must open at least
n/2  O(1) envelopes. HINT: This is completely
straightforward.
 Assume that each of the n! permutations of the inputs is
equally likely. Show that there is a deterministic algorithm
where the expected number of envelopes that is opens is
O(1). HINT: This is a straightforward consequence of some
facts that we learned about Bernoulli trials.
 Give a Monte Carlo algorithm that opens O(log n) envelopes
and has probability of error < 1/n. You must show
that the probability of error is small. HINT: This is a
straightforward consequence of some facts that we learned
about Bernoulli trials.
 Show using the version of Yao's technique for Monte Carlo
algorithms that you developed in the last homework
assignment to show that every Monte Carlo algorithm must
open Omega(log n) envelopes if it is to be incorrect with
probability < 1/n. HINT: This is a straightforward
application of the Yao's technique for Monte Carlo
algorithms that you developed in the previous homework
problem.
 Give a Las Vegas algorithm where the expected number of
opened envelopes is O(n^(1/2)).
 Hint: Take some random guesses for the first half of the
envelopes, and then if you don't find a 1 bit, give up and
do the most obvious thing.
 Hint: See the discussion of the Birthday paradox in
section 5.4.1. You may use facts from the analysis of the
Birthday paradox in the book without proof.
 Show that every Las Vegas algorithm for the previous
envelope problem must open Omega(n^{1/2}) envelopes in
expectation.
 Hint: Use Yao's technique and the following probability
distribution.
 With probability half, sqrt(n) uniformly distributed
random bits in [1,n/2] are set to 1 and the remaining bits
in that interval are 0, bits in the interval [n/2 + 1 , n/
2 + sqrt(n) ] are all set to 0, and the remaining
bits are 1.
 For k = 0 , ..., sqrt(n) − 1, with probability 1/(2
sqrt(n)), bits [1 , ..., n/ 2] contains a uniformly
distributed random set of k 0's and the rest are 1's. Then
sqrt( n) − k 0's are contained in uniformly distributed
random bit positions in [ n/ 2 + 1 , n/ 2 + sqrt(n) ], and
the remaining k bits in positions [ n/ 2 + 1 , n/ 2 +
sqrt(n) n ] are 1's. The remaining bits in the stream are
0.
 Wednesday February 19
 (Extra Credit) Consider a
complete binary tree where every leaf has depth k. There are
then 2^{k} leaves. The internal nodes of the tree
represent a NOR operation. There are binary 0/1 variables x(1)
... x(2^{k}) associated with the leaves. The
algorithm's goal is to determine the value of the root. So for
example if the leaves were 1 0 0 0, the left child of the root
would be 1 NOR 0 = 0, right child of the root would be 0 NOR 0
= 1, and the root would be the NOR of its children = 0 NOR 1 =
0. The values of the leaves are not known a priori. The
algorithm can query the value of a particular leaf. We are
concerned with the number of queries required. Some of these
questions may be somewhat hard, do the ones that you can. If
you don't get a particular subproblem, you can still assume
the result for later subproblems.
 Develop an adversarial strategy to show that every
deterministic algorithm needs Omega(2^{k}) queries
in the worst case. That is, every deterministic algorithm
must query a constant fraction of the leaves. HINT: Note
that if you replace the nodes of odd depth by AND
operations, and nodes at even depth by OR operations, you
get essentially the same circuit/tree. But it may be easier
to think about the lower bound in the tree with AND and OR
operations.
 Consider a randomized algorithm that performs a depth
first search and picks the child to visit first uniformly
and independently. If the first child visited returns a 1,
then the other child doesn't need to be evaluated/visited.
Show the the expected number of queries needed by this
algorithm is o(2^{k}).
 Assume that each variable is 1 with probability p=(35^{1/2})/2
and 0 with probability 1p, independently of the other
variables. Consider the algorithm that performs a depth
first search traversal of the tree, skipping the second
subtree if the algorithm doesn't need to know the value of
that subtree. If the value of the first subtree is 1, then
the algorithm knows that the output of the NOR operation for
that node is 0. Show that the average query complexity of
this algorithm is O((2p)^{k}). HINT: What is
special about p=(35^{1/2})/2 ?
 Show that the deterministic algorithm given in the
previous problem is optimal with respect to the average
number of queries for this distribution. Be very very
careful here, you want a formal proof, not handwavy
intuition. You can not make any unjustified assumption about
the deterministic algorithm.
 Conclude using Yao's technique that the query complexity
for any Las Vegas algorithm is Omega((2p)^{k}).
 162. For each part, prove the correctness of of your greedy
algorithm using an exchange argument. Don't worry about the
running time. For part a, the most obvious algorithm and
exchange works. For part b, the most obvious (or at least one
obvious) possible exchange does not work, so you need to be a
bit careful.
 Friday February 21
 151. Explain how to solve this problem in linear time.
Hint: Depth First Search
 154
 Monday February 24
 153 Hint: Think about starting your search from the
center of the palindrome.
 153
 Wednesday February 26

There are three shortest path algorithms covered in chapter 24
(BellmanFord, Dijkstra, and the topological sort algorithm
for directed acyclic graphs). For each of the following
problems, pick the most appropriate of these three shortest
path algorithm to apply to obtain an algorithm for the
problem. This may or may not involve modifying the algorithm
slightly. If you need to modify the algorithm, explain how.
You may need to first briefly explain why the problem is
indeed just a shortest path problem in disguise; That is,
state how one obtains the graph, and why the shortest path in
this graph corresponds to a solution to the problem. Give the
running time of the resulting algorithm.
 The problem described in 242
 The problem described in 243
 The problem described in 246
 The problem of finding the path where the minimum edge
weight is maximized. You need such an algorithm to implement
one of the KarpEdmonds variations on FordFulkerson.
 Friday February 28
 Show how each of problems described in 261, 262 and
263 can be efficiently reduced to network flow. Give the
running time of the resulting algorithms for each problem
assuming that you can solve network flow in time N(V, E),
where N is some function of the number of vertices V and the
number of edges E in the network.
 Monday March 3

26..54 Hint: First you need to understand the discharge
operation described in section 26.5. Then explain why if the
height labels are not increased for n consecutive discharges,
then the flow must be optimal. Then explain why the number of
nonsaturating pushes is O(n^3)
 Wednesday March 5
 We consider the minimum spanning tree problem defined
in chapter 23 of the text.
 Give an integer linear programming formulation using the
following intuition, and prove that your formulation is
correct: There is an indicator 0/1 random variable for each
edge. You must choose at least n1 edges (n is the number of
vertices in the graph). For each subset S of k vertices, you
can choose at most k 1 edges connecting vertices in S.
Explain why the size of this linear program can be
exponential in the size of the graph.
 Give an integer linear programming formulation using the
following intuition, and prove that your formulation is
correct: There is an indicator 0/1 random variable for each
edge. You must choose at exactly n1 edges. For each subset
S of vertices (S not the empty set and not all the
vertices), you can choose at least one edge with one
endpoint in S and one endpoint not in S. Explain why the
size of this linear program can be exponential in the size
of the graph. HINT: Theorem 23.1 in the text may be useful.
 Give a polynomial sized integer linear programming
formulation using the following intuition, and prove that
your formulation is correct: Call an arbitrary vertex the
root. Think of a spanning tree as routing flow away from r
to the rest of the tree (but now you do not have flow
conservation at the vertices). Explain why the size of this
linear program is polynomially bounded in the size of the
graph.
 Consider a relaxation of the integer linear program in the
last subproblem in that now the flows on the edges may be
rational (and not necessarily integer).
 Show how to express a feasible solution to the linear
program as an affine
combination of rooted spanning trees. HINT: The
coefficient for the first tree will be the least flow on
any edge. And then repeat this idea.
 Conclude that the minimum spanning tree is an
optimal solution to this linear program. That is, explain
how to take the minimum spanning tree and construct a
solution to this linear program with objective value equal
to the weight of the minimum spanning tree. Then show that
every other feasible solution as weight at least the
weight of the minimum spanning tree.
 Friday March 7
 Consider a two person game specified by an m by n payoff
matrix P. The two players can can be thought of as a row
player and a column player. The number of possible moves for
the row player is m and the number of possible moves for the
column player is n. Each player picks one of its moves, and
then money is exchanged. If the row player makes move r, and
the column player makes move c, then the row player pays the
column player P_{r,c} dollars. Note that P_{r,c} could be
negative, in which case really the column player is paying
money to the row player. We assume that the game is played
sequentially, so that one player specifies his move, the other
players sees that move, and then specifies a response move (we
will assume that this player makes the best possible
response). Obvious each player wants to be payed as much money
as possible, and if this is not possible, to pay as little as
possible. HINT: All of these subproblems are easy, so if
you are heading toward a complicated answer, you might want to
reevaluate.
 Trivial warmup problems:
 Give an algorithm that will efficiently compute the
best response for the column player give a specific move
by the row player.
 Give an algorithm that will efficiently compute the
best first move by the row player given that the column
player will give its best response
 Either give an example of a payoff matrix where
it is strictly better for each player to go second, or
argue that there is no such payoff matrix. HINT:
Roshambo
 Now we change the problem so that each player
specifies a probability distribution over his moves, and
then the row player pays the column player E[P_{r,c}], where
the expectation is taken over the two probability
distributions.
 Give an algorithm that will efficiently compute the best
response (which is probability distribution over column
moves) for the column player given a probability
distribution specified by the row player.
 Give an algorithm that will efficiently compute the best
first move (probability distribution over row moves) for
the row player given that the column player makes the best
response. Hint: Linear programming
 Show the linear program for this payoff matrix

 Give an algorithm that will efficiently compute the best
first move (probability distribution over column moves)
for the column player given that the row player makes the
best response. Hint: Linear programming
 Show the linear program for this payoff matrix

 Either give an example of a payoff matrix where it
is strictly better for each player to go second, or argue
that there is no such payoff matrix.
 Hint: Strong inear programming duality.
 Consider the envelope bit sequence problem that was due on
February 17. Assume that the statement of the problem was
correct, and that every Las Vegas algorithm will open
Omega(sqrt(n)) envelopes in expectation for some inputs. Can
this necessarily be proven by Yao's technique? That is, is
there necessarily a input distribution that will cause every
deterministic algorithm to open Omega(sqrt(n)) envelopes in
expectation? Explain.
 Monday March 17
 Consider the problem of constructing a maximum
cardinality bipartite matching. See section 26.3 in the book,
or here is a brief discrption. The input is a bipartite
graph, where one bipartition are the girls, and one
bipartition is the boys. There is an edge between a boy and a
girl if they are willing to dance together. The problem is to
matching the boys and girls for one dance so that as many
couples are dancing as possible.
 Construct an integer linear program for this problem
 Consider the relaxed linear program where the integrality
requirements are dropped. Explain how to find an integer
optimal solution from any rational optimal solution.
Hint: Find cycles of edges who associated variables are not
integer.
 Construct the dual program.
 Give a natural English interpretation of the dual problem
(e.g. similar to how we interpreted the dual of diet problem
as the pill problem)
 Explain how to give a simple proof that a graph doesn't
have a matching of a particular size. You should be able to
come up with a method that would convince someone who knows
nothing about linear programming.
 Assume that you have a park (mathematically a 2D plane)
containing k lights and n statues. In particular, you know for
each light L and for each statue S, whether light L will
illuminate statue S if light L is lit. Further you are told
for each light, the cost C_L for turning on light L. The goal
is to light all the statues while spending as little money as
possible.
 Construct an integer linear program for this problem where
there are binary indicator variables for each light
signifying whether the light is lit or not.
 Consider the relaxed linear program where the variables
are allowed to be any rational between 0 and 1. Give an
English explanation of the problem that this models. HINT:
Imagine the lights have a dimmer control.
 Show that the relaxed linear program where the variables
are allowed to be any rational between 0 and 1 can have a
strictly smaller objective than the optimal objective for
the integer linear program for some instances.
 Construct the dual program for the relaxed linear program.
 Give a natural English interpretation of the dual problem
(the problem modeled by the dual linear program).
 Explain how to give a simple proof that a certain cost is
required for the problem modeled by the relaxed linear
program (the one with dimmer controls) using this natural
interpretation of the dual.
 Wednesday March 19
 Consider the problem of scheduling a collection of processes
on one processor. Each process J_i has a size x_i a release
time r_i , and a deadline d_i. All these values are
positive integers. The goal is to find the slowest possible
speed that will allow you to finish each job between its
release time and deadine. A job of size x_i that is run at
speed s, takes x_i/s units of time to complete. A processor
can switch between processes arbitrarily. For example, the
processor can run J_1 for a while, then switch to J_2, then
back to J_1, then to J_3, etc.
 Express this problem as a linear program
 Construct the dual program.
 Give a natural English interpretation of the dual problem
(e.g. similar to how we interpreted the dual of the max flow
problem as the min cut problem).
 Explain how to give a simple proof that the input is
infeasible for a particular speed. You should be able to
come up with a method that would convince someone who knows
nothing about linear programming.

Prove that each of the problems defined in 34.51, 34.52,
34.53, 34.55, 34.56, 34.57, and 34.58 are NPhard using a
reduction using a reduction from an NPcomplete problem of
your choice that is defined earlier in Chapter 34. So for each
problem, you need to give one polynomial time reduction. The
difficulty of finding the redutions ranges from trivial to
reasonably straightforward.
 Friday March 21

Show that the 3COLOR problem is NPhard by reduction from the
3CNFSAT problem. 3COLOR is defined in problem 343 in the
text, which also contains copious hints.
 Monday March 24
 355 parts a, b and d.
 35.24 Use the minimum bottleneck spanning tree as your
lower bound for the optimal bottleneck tour. Show using
an exchange argument that Kruskal's algorithm computes the
optimal minimum bottleneck spanning tree
 Wednesday March 26

Prove that if there is a polynomial time approximation
algorithm for the maximum clique problem that has
approximation ratio 1000 then there is a polynomial time
approximation algorithm with approximation ratio 1.000000001.
This is actually a slightly easier problem than problem 352
part b in the book, which I suggest that you look at for
inspiration. Note that in some sense this can be viewed as a
gap reduction.
 Consider the simple randomized algorithm that flips a fair
independent coin for each vertex to determine which
bipartition that that vertex is in.
 Show that this is a 2 approximation algorithm for this
problem. Hint: Consider the algorithm and analysis for
MAX3SAT.
 We now want to develop a deterministic polynomialtime
2approximation algorithm for this problem using the method
of conditional expectations, which considers the vertices
one by one, but instead of flipping a coin for each
vertex v, puts v in the bipartition that would maximize the
expected number of edges in the cut if coin flips were used
for the remaining vertices. Give a simple greedy algorithm
that ends up implementing this policy. Prove that this
algorithm has approximation ratio at most 2.
 Friday March 28
 (extracredit) Give a fully
polynomial time approximation scheme for the problem described
in problem 355 in the text, when m = O(1), using the
following approach:
 Give a dynamic programming algorithm whose time in
polynomial in n, and P^m, where P is the total processing
times of all of the jobs. So this is not a polynomial time
algorithm.
 Explain how you can essentially restrict your attention to
jobs that are not too small (say less than the maximal
processing time / n^2), and then round jobs sizes, so
that the dynamic program will run in polynomial time, and
give you a (1+epsilon)approximation.
 Monday March 31
 Problem 17.36. You must use a potential function analysis
to prove O(1) amortized time. Hint: The potential function for
dynamic tables will be useful.
 173
 Wednesday April 2
 Assume that you have a collection of n boxes arriving online
over time that must be loaded onto m trucks. When a box
arrives, the online algorithm learns the weight of the box,
and a list of trucks that that box can be loaded on. So not
every box is allowed to be loaded on every truck. At the time
that a box arrives, the online algorithm must pick a truck to
load the box on. The objective is to minimze the weight of the
most heavily loaded truck. Give an adversarial argument to
show no deterministic online algorithm can achieve
approximation ratio O(1). Hint: In your adversarial
strategy, later arriving boxes should be made only assignable
to trucks that the online algorithm assigned boxes to earlier.
 Consider the paging problem. Consider the following
randomized online algorithm.
 ALGORITHM DESCRIPTION: Each page P has an associated bit:
FRESH or STALE. If requested page P in fast memory, then P's
associated bit is set to FRESH. If the requested page P is
not in fast memory, then a STALE page is selected uniformly
at random from the STALE pages in fast memory and ejected,
and P's associated bit is set to FRESH. If the request page
P is not in fast memory, and all pages in fast memory are
FRESH, then make all pages in fast memory STALE, select a
STALE page uniformly at random from the STALE pages in fast
memory to evict, and P associated bit is set to FRESH.
 Show that this algorithm is O(log k)
competitive/approximate using the following strategy (recall
k is the size of the fast memory). Partition the input
sequence into consecutive subsequences/phases where there
are exactly k distinct pages request in each
subsequence/phase. The phase breaks are when all pages in
fast memory are made STALE. Let m_i be the number of pages
requested in phase i that were not requested in phase i1.
Use the following strategy:
 Show that the optimal number of page faults is
Omega(sum_i m_i)
 Show that the expected number of page faults for the
randomized algorithm on the page requests in phase i is
O(m_i log k)
 Friday April 4
 Consider an online or approximation problem where there are
only finitely many posible algorithms and finitely many
possible inputs. We generalize Yao's technique to
approximation ratios. The correct answer is "yes" to three of
the following four questions, and the correct answer is "no"
for the remaining question. Identify the three questions where
the answer is yes, and give a proof that the answer is yes. For extra credit, prove that the correct
answer is no for the remaining question.
 Assume that the problem is a minimization problem
 Assume that you have an input distribution I, such that
for all deterministic algorithms A it is the case that
E[A(I)]/E[Opt(I)] > c. Can you logically conclude that
the expected competitve ratio for every randomized
algorithm is at least c?
 Assume that you have an input distribution I, such that
for all deterministic algorithms A it is the case that
E[A(I)/Opt(I)] > c. Can you logically conclude that the
expected competitve ratio for every randomized algorithm
is at least c?
 Assume that the problem is a maximization problem
 Assume that you have an input distribution I, such that
for all deterministic algorithms A it is the case that
E[Opt(I)]/E[A(I)] > c. Can you logically conclude that
the expected competitve ratio for every randomized
algorithm is at least c?
 Assume that you have an input distribution I, such that
for all deterministic algorithms A it is the case that
E[Opt(I)/A(I)] > c. Can you logically conclude that the
expected competitve ratio for every randomized algorithm
is at least c?
 Use a correct generalization of Yao's techique to show that
the expected competitive ratio for every randomized paging
algorithms is Omega(log k). Hint: Assume that the number of
pages is one more than the size of fast memory, and the most
obvious input distribution.
 Use a correct version of Yao's technique to show that
the expected competitve ratio of every randomized algorithm
for the List Update problem is at least 1+epsilon for some
epsilon > 0 of your choice. HINT: It is sufficient to
consider the case of a two element list and the most obvious
input distribution.
 Monday April 7 (This is
the last homework problem for the semester !)
 Consider the paging problem. Consider the following
deterministic online algorithm.
 ALGORITHM DESCRIPTION: Each page P has an associated bit:
FRESH or STALE. If requested page P in fast memory, then P's
associated bit is set to FRESH. If the requested page P is
not in fast memory, then an arbitrary STALE page is selected
from the STALE pages in fast memory and ejected, and P's
associated bit is set to FRESH. If the request page P is not
in fast memory, and all pages in fast memory are FRESH, then
make all pages in fast memory STALE, select an arbitrary
STALE page from the STALE pages in fast memory to evict, and
P associated bit is set to FRESH.
 Show that this algorithm with k pages of fast memroy is
2competitive/approximate against the optimal algorithm for
k/2 pages of fast memory, using the following potential
function Phi = sum_{pages p in fast memory for the online
algorithm} credit(p) +2 * sum_{pages p in the
optimal/adversary's memory} (1  credit(p)), where credit(p)
is equal to 1 if page p is in the algorithm's fast memory
and is FRESH, and credit(p)=0 otherwise. So you need to show
that:
 Initially when fast memory is empty, the potential
function is 0.
 You need to show that the potential function is never
negative
 For the online algorithm, an accessed page could (a) not
be in fast memory, or (b) be in fast memory and be FRESH,
or (c) be in fast memory and be STALE. For the online
algorithm, the pages in fast memory could either be all
STALE, or some could be FRESH. For the optimal algorithm,
the accessed page could be in fast memory, or may not be
in fast memory. You need to show that for all of these
possiblities: Online cost + change in the potential
<= 2* (Optimal cost)