Question: Suppose you want to have a program that evaluates polynomials. Here's (presumably) the simplest possible program. Input: polynomial p(x) = a_0 + a_1x + a_2x^2

Suppose you want to have a program that evaluates polynomials. Here's (presumably) the simplest possible program. Input: polynomial p(x) = a_0 + a_1x + a_2x^2 + + a_n x^n n, the degree alpha, a real number Output: p(alpha) (the value of p at x = alpha) Return (a_0 + middot alpha + a_2 middot alpha^2 + + a_n middot alpha^n) How many additions and multiplications occur when this code is run? What is the asymptotic time complexity? (Important: exponentiation does not count as an "atomic operation"; you need to count the number of multiplication needed.) The above is pretty wasteful; why should the computer calculate alpha^12 and later alpha^13 from scratch? Write pseudo code that saves computation time by looping through the terms of the polynomial, calculating successive powers of alpha more efficiently. What is its asymptotic time complexity
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
