# CMPSCI 611: Theory of Algorithms

### Questions and Answers on Homework #1

Questions are in black, answers in blue.

• Question 1.11, 22 September: On page 3 of the Adler notes, big-Omega is defined without specifying that the constant c must be positive and not zero. Is this a mistake?

Yes, if f = Ω(g) then there must exist a positive real number c such that f(n) is at least cg(n) for sufficiently large n.

• Question 1.10, 22 September: Two questions on 1.5c:
1. The symbol "n" is used many times in the problem description, but it is not clear what "n" means. Is "n" the number of bits in the two integers to be multiplied together?

Actually it is the maximum possible number of bits in the answer -- the number of coefficients in the polynomial C(x). Is this the same "n" as the "n"'th roots of unity? Is that the same "n" as in "p = kn + 1"?

Yes. You're going to multiply two polynomials, whose product has degree at most n-1, using FFT and thus using n'th roots of unity. You're told that these roots of unity exist if p is equal to kn+1 for some k.

2. In the final sentence of the problem, there is no reference to "p". This was confusing as it seems that "p" is not related to the question, despite being discussed at length. Were we meant to provide a method to multiply two integers modulo p?

No, you are asked to multiply two integers in ordinary binary notation and get a binary result. You're going to use FFT to help you do this, and FFT needs roots of unity. Rather than use the roots of unity in the complex numbers, you're going to use the roots of unity in the field of integers modulo p. That's where p comes in -- when you add and multiply "numbers" in the FFT algorithm, these are going to be additions and multiplications modulo p.

• Question 1.9, 22 September: When I print out the pages from this web site, the Greek and mathematical symbols don't print! What can I do?

The snarky answer is that you should get software that supports standard HTML. But failing that, using "View Source" will tell you which symbol goes in which blank space.

• Question 1.8, 22 September: In 1.1, how can we show a Θ bound on the function g when we are only given a big-O bound on it? (We're told it is O(nk).)

Actually the new conditions on f make that O(nk) bound irrelevant. The reason you now know bounds on g is that g is increasing, g agrees with f on the input values bi, and f is either Θ(nα) or Θ(nα log n). These conditions prevent g from being too small.

• Question 1.7, 22 September: I don't think your polynomial arithmetic is right in 1.6 below...

You're right, it wasn't -- it is now. Corrections are in green. Sorry.

• Question 1.6, 21 September: I'm still confused about Problem 1.5 -- is C an integer or a polynomial?

The point of the problem is that FFT gives us a fast way to multiply polynomials, and we would like to use it to help us multiply integers quickly. Here's an example. We have two integers A = 13 and B = 7. We form polynomials A(x) = 1 + x2 + x3 and B(x) = 1 + x + x2, so that A(2) = 13 and B(2) = 7. The product of these two polynomials is C(x) = 1 + x + 2x2 + 2x3 + 2x4 + x5. C(2) is equal to 91, the product of 13 and 7, but the coefficients of C(x) do not immediately give us the bits of the binary representation of 91.

In part (a) you have to figure out how to get from the coefficients of C to a binary representation of C(2), and how much time this will take. In part (b) you have to look at how many bit operations (such as AND and OR) you will need to carry out the FFT algorithm.

• Question 1.5, 20 September: In Problem 1.4 (a) you don't give a required running time for our solution. I have a simple algorithm that solves the majority element problem in O(n log n)...

Sorry, of course I meant for you to solve it in O(n) time -- this has been corrected on the assignment page.

• Question 1.4, 19 September: Even after the earlier corrections, I don't think the result of Problem 1.1 is true. If f were Θ(nk) it would work, but it's only O(nk). I think that f could periodically get much smaller than g and still satisfy the given conditions.

You're right, and I have corrected the assignment sheet. You can get up to five extra points for decscribing your counterexample to the statement I originally asked you to prove.

• Question 1.3, 17 September: In Problem 1.4, can't I just use the median again in part (b)? My solution to part (a) only tests elements for equality with the median.

font color=blue>But (as you realized in another email a few minutes later) you don't know how to find the median if the elements are not `Comparable` -- it isn't even defined!

• Question 1.2, 15 September: Wait a minute, don't the functions f and g in Problem 1.1 have to be increasing, or at least nondecreasing, for the result to be true?

You're right, I corrected this as well.

And in Problem 1.4 (b), do you really mean to solve the "element distinctness problem" in O(n) time? I read that this requires Ω(n log n).

Another mistake, sorry, I meant the same "majority element problem" from the rest of problem 1.4.

• Question 1.1, 15 September: In Problem 1.1, may we assume that f and g are functions from the positive reals to the positive reals?

Yes. Corrected on the assignment page.

Also, is the variable i an integer like i0 or may it be any real?

It must be an integer. Also corrected on the assignment page.