# feb20 - Illinois Institute of Technology Department of...

This preview shows pages 1–2. Sign up to view the full content.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Illinois Institute of Technology Department of Computer Science Lecture 9: February 20, 2008 CS 330 Discrete Structures Spring Semester, 2008 1 Polynomial evaluation: how complexity depends on the method As part of the development of a polynomial approximation to the arctangent function (such as would be required in most compilers), a first-year graduate student in Computer Science at Cornell University 1 was asked to write a program to compute the coefficients of a polynomial given its roots. In other words, values r 1 , r 2 , . . . , r n were given, and it was necessary to compute the coefficients a , a 1 , . . . , a n- 1 in the n th degree polynomial a + a 1 x + a 2 x 2 + ··· + a n- 1 x n- 1 + x n = ( x- r 1 )( x- r 2 ) ··· ( x- r n ) . The student remembered, from a high-school course in algebra, that a k = (- 1) n- k · · the sum of all ( n n- k ) possible prod- ucts of n- k of the roots ¸ . (1) We can prove (1) with the kind of argument we used to prove the binomial theorem: We ask how a term x k can be formed in the unsimplified product ( x- r 1 )( x- r 2 ) ··· ( x- r n ). Such a term can occur if k of the n terms contribute their x-term, and the remaining n- k contribute their r-term; there are, of course ( n n- k ) ways to choose the terms that contribute their r-term. Having come up with a correct algorithm for the problem he faced, the student rushed ahead to write the program implementing the algorithm suggested by equation (1). His behavior was typical—the algorithm is correct and relatively easy to implement, so no thought was given to the quality of the algorithm. The program worked beautifully on the various polynomials used as test cases, but when applied to the twelfth and higher degree polynomials for which it was expressly written, it used unreasonable amounts of time....
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

feb20 - Illinois Institute of Technology Department of...

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

View Full Document
Ask a homework question - tutors are online