ps2sol - Introduction to Algorithms Massachusetts Institute...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Algorithms October 1, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Piotr Indyk and Charles E. Leiserson Handout 9 Problem Set 2 Solutions Reading: Chapters 5-9, excluding 5.4 and 8.4 Both exercises and problems should be solved, but only the problems should be turned in. Exercises are intended to help you master the course material. Even though you should not turn in the exercise solutions, you are responsible for material covered in the exercises. Mark the top of each sheet with your name, the course number, the problem number, your recitation section, the date and the names of any students with whom you collaborated. You will often be called upon to “give an algorithm” to solve a certain problem. Your write-up should take the form of a short essay. A topic paragraph should summarize the problem you are solving and what your results are. The body of the essay should provide the following: 1. A description of the algorithm in English and, if helpful, pseudo-code. 2. At least one worked example or diagram to show more precisely how your algorithm works. 3. A proof (or indication) of the correctness of the algorithm. 4. An analysis of the running time of the algorithm. Remember, your goal is to communicate. Full credit will be given only to correct algorithms which are which are described clearly . Convoluted and obtuse descriptions will receive low marks. Exercise 2-1. Do Exercise 5.2-4 on page 98 in CLRS. Exercise 2-2. Do Exercise 8.2-3 on page 170 in CLRS. Problem 2-1. Randomized Evaluation of Polynomials In this problem, we consider testing the equivalence of two polynomials in a finite field. A field is a set of elements for which there are addition and multiplication operations that satisfy commutativity, associativity, and distributivity. Each element in a field must have an additive and multiplicative identity, as well as an additive and multiplicative inverse. Examples of fields include the real and rational numbers. A finite field has a finite number of elements. In this problem, we consider the field of integers modulo p . That is, we consider two integers a and b to be “equal” if and only if they have the same remainder when divided by p , in which case we write a b mod p . This field, which we denote as Z /p , has p elements, { 0 , . . . , p 1 } .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Handout 9: Problem Set 2 Solutions Consider a polynomial in the field Z /p : n a ( x ) = a i x i mod p (1) i =0 A root or zero of a polynomial is a value of x for which a ( x ) = 0 . The following theorem describes the number of zeros for a polynomial of degree n . Theorem 1 A polynomial a ( x ) of degree n has at most n distinct zeros. Polly the Parrot is a very smart bird that likes to play math games. Today, Polly is thinking of a polynomial a ( x ) over the field Z /p . Though Polly will not tell you the coefficients of a ( x ) , she will happily evaluate a ( x ) for any x of your choosing. She challenges you to figure out whether or not a is equivalent to zero (that is, whether x ≤ { 0 , . . . , p 1 } : a ( x ) 0 mod p ).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 13

ps2sol - Introduction to Algorithms Massachusetts Institute...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online