- Wednesday January 14

- Read the syllabus
- Join the class group https://groups.google.com/forum/#!forum/pitt-cs-2015-spring-2015

- Problem 3-3 part a. You need not provide justifications for
your order. If you aren't able to find a group, you can do
this individually. While I encourage you to use LaTex, it is
not strictly required for this assignment. You may hand write
these solutions.

- Friday January 16

- Problem 3-4. For conjectures that are untrue, explain which
reasonable class of functions the statement is true for. For
example, you might say "The statement is untrue in general,
and here is an example. But the statement is true if the
functions are strictly increasing, and here is a proof."

- 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 exists, 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)
- Wednesday January 21
- 8.1-3 Given an adversarial strategy and prove that it is
correct.

- 8.1-4. Give an adversarial strategy and prove that it is correct.
- Problem 8-6. For part a and b, is essentially asking you to consider the adversarial strategy that answers so as to maximize the number of the original ways of merging two sorted lists that are consistent with the answer. You will likely find Stirling's approximation for n! useful. For parts c and d, come up with a different adversarial strategy. 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?
- Friday January 23
- 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 determine 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 (n-1)! permutations pi of {1, ... n} where pi(1)=1, and the corresponding points in n dimensional space. Note that all (n-1)! 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.
- Consider a distributed ring network of n computers where each node starts with a unique arbitrary O(log n) bit ID in the range [1, n]. Note the word "arbitrary" means you can not make any assumptions about the ordering of the ID's on the ring. In each synchronous round, each computer can sends a message of unbounded size to its clockwise neighbor. The computers' goal is to assign a label to each node in such a way that no two adjacent computers are assigned the same label (call this a proper labeling). Formally a label is just a sequence of bits of some fixed length. The objective is to use as few rounds of communication as possible.
- Upper Bound
- As a super easy warm-up, give an algorithm that uses O(n) rounds to obtain a proper O(1) bit labeling.
- As a super easy warm-up, give an algorithm that in 0 rounds obtains a proper labeling with O(log n) bit labels.
- Give an algorithm that uses 1 round to obtain a proper labeling using O(log log n) bit labels. Hint: Each computer can only learn the ID of its counterclockwise neighbor. Consider the first bit on which these IDs differ. This is enough information to produce a label.
- Give an algorithm that uses 2 round to obtain a proper
labeling using O(log log log n) bit labels. Hint: See the
above hint.

- Extend this idea to give an algorithm that uses O(log^*
n) rounds to obtain a proper labeling using O(1) bit
labels.

- Lower Bound

- As an easy warm-up give an adversarial argument to show that every algorithm that obtains a proper labeling in 0 rounds requires Omega(log n) bit labels. 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 if there is an algorithm that there is an
algorithm A that obtains a proper labeling in 1 rounds
using c bits, then an algorithm B that obtains a proper
labeling in 0 rounds using O(2^c) bits.

- Hint: This is conceptually a bit tricky. First
understand why one can think of A as a function F that
takes two ID's as inputs and outputs a label. Why is
this trivial statement if F is injective?

- So for the moment consider the case that this function
has the property that every label in the range has at
least different ID pairs that map to it. Now in zero
round protocol, each computer only knows one of these
two IDS, its own; It does not actually know the ID of
the computer counterclockwise to itself. But it can
compute the collection of possible labels that it might
produce for the various possible ID's for its
counterclockwise neighbor. Key Point: Why does the
correctness of A mean that the collection of possible
labels for two adjacent computers can not be identical?
How should B use this insight to produce a label.

- Then explain how to accomplish this without any
assumptions on F.

- Show that if there is an algorithm that there is an
algorithm A that obtains a proper labeling in 2 rounds
using c bits, then an algorithm B that obtains a proper
labeling in 1 rounds using O(2^c) bits. Hint: Imagine that
you are running A, but you stop it one round early. Now
imagine that you are a computer, and have to produce a
label at this point. Think about how what information the
computer would have obtained if A was run for one more
round, and what collection of labels the computer might
have produced. Key question: What can you say about the
collection of labels for consecutive computers if A is
correct? Ask yourself how you might B produce a label from
the collection of labels that the computer might have
produce if A were allowed one more round. Then show that
this labeling is proper.

- Show that if there is an algorithm that there is an
algorithm A that obtains a proper labeling in k rounds
using c bits, then an algorithm B that obtains a proper
labeling in k-1 rounds using O(2^c) bits. Hint: If you an
do it for k=1, it basically works the same in general.

- Conclude that any algorithm that obtains a proper labeling using O(1) bit labels takes Omega(log^* n) rounds.
- Monday January 26
- 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 two-way 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.
- Wednesday January 28
- 8-4. For part b give an adversarial strategy. For part c, use linearity of expectations in your algorithm analysis.
- 4-3 except for part d.

- Apply the Master Theorem (Theorem 4.1) whenever
applicable.

- For part f use induction; You will need 2 inductive proofs, one for the upper bound and one for the lower bound.
- Otherwise, draw the recursive call tree and sum up the costs level by level
- Friday January 30