Question: ( 2 0 pts . ) Polynomial computation analysis. Suppose we want to evaluate the polynomial p ( x ) = a 0 + a

(20 pts.) Polynomial computation analysis. Suppose we want to evaluate the polynomial
p(x)=a0+a1x+a2x2+cdots+anxn
at some point x0.
(a) Consider the algorithm that computes first x0i for each i, using the fast exponentiation algorithm from lectures (without taking mod). Then, it computes a1x0,a2x02,a3x03,dots,anx0n(independently) and, finally, it adds all of these numbers to a0 to obtain p(x0). How many sums and how many multiplications are involved in this algorithm? Please provide short explanations. (You can give your answer in O-notation.)
(b) We show next how to do better using Horner's rule. Prove that the following algorithm outputs p(x0).
Algorithm 1 Horner's rule
z=an
for i=n-1 to 0 do:
z=z*x0+ai
end for
return z
CMPSC 465, Spring 2024, HW 2
1
(c) How many additions and multiplications does this algorithm use as a function of n? Please provide short explanations. (You can give your answer in O-notation.)
 (20 pts.) Polynomial computation analysis. Suppose we want to evaluate the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!