You are on page 1of 2

Comp 7713/8713 (Advanced Topics: Algorithms ) Spring 2017.

Homework
1.
Submissions: This assignment is due on the 17th of February, 2017. Each student must submit his or her own assignment.
Solutions should preferably be typed in Latex, MSWord or other such word processing software, or printed clearly. In
the former case, please submit a pdf file by email and in the latter case just hand me your solution. You must write your
name and UUID clearly on your submitted assignment.

Academic Integrity: You are encouraged to work in groups, but everyone must write out their own solutions. Absolutely
no word to word copying is allowed. If you have worked with other students on the assignment or referred to external
sources, please mention all names and sources on your assignment.

Partial solutions: Document your efforts at solving a problem even if you cannot solve it. Write why your approach
failed.

Problem 1 [25 pts]: You have two sets A, and B, each having n integers in the range 0 to 10n. Consider the set
C = {x + y : x A and y B}. Notice that the integers in C are in the range 0 to 20n. Suppose we want to compute
the elements of C as well as how many times each element of C is realized as the sum of elements in A and B. Give a
O(n log n) time algorithm to solve this problem.

Problem 2 [30 pts]: Suppose we want to print a set of words, possibly on multiple lines, in given order w1 , w2 , . . . , wn .
The length of the words are l1 , l2 , . . . , ln characters, i.e., li is the length of wi . Between any two words a space character
needs to be printed. Each character, and the space character, takes the same width on a line which can accommodate
M characters in all. If the words li , . . . , lj are printed on a line, the number of space characters at the end of the line
Pj
is = M (j i) k=i lk : of course we must make sure 0 so that the words can fit on the line. To make our
printing neat, we wish to minimize the number of white space characters at end of lines - the exact criteria we use is the
following: The sum of the cubes of the extra white space characters must be as small as possible on all the lines except
for the last one. Give a dynamic programming algorithm to figure out the characters to be printed on each line. What is
the running time and space complexity of your algorithm?

Problem 3 [25 pts]: Show that if (S, I) is a matroid, then (S, I 0 ) is a matroid, where

I 0 = {A0 : S A0 contains some maximal A I}.

That is, the maximal independent sets of (S, I 0 ) are just the complements of the maximal independent sets of (S, I).

Problem 4 [20 pts]:

Compute, by hand, the optimal solution of the following LPs by using the simplex method. Write out each pivot step,
and the tableau before and after it.

(A)

maximize 2x1 + 4x2


subject to
2x1 + 4x2 4
2x1 + 3x2 3
4x1 + 5x2 5
x1 + 5x2 1
x1 , x2 0

1
(B)

minimize 2x1 + x2
subject to
x1 + 2x2 6
3x1 + 2x2 12
x1 , x2 0

You might also like