Question: Horner's Rule is an algorithm to efficiently evaluate a polynomial f ( x ) = i = 0 N a i x i = a

Horner's Rule is an algorithm to efficiently evaluate a polynomial
f(x)=i=0Naixi=aNxN+aN-1xN-1+cdotsa1x+a0
Here's the algorithm where the polynomial coefficients (a0,a1,dots,aN) are all stored in
an array or vector container a :
poly =0;
for (int i = N; i>=0; i --)
poly = x* poly +a[i]
(a) Walk through the steps and show how the algorithm is used to calculate f(2) for
f(x)=3x4-2x3+x2-7(so x=2 in this case).
(b) Explain why this algorithm works.
(c) Find the running time and explain why it is what it is.
Horner's Rule is an algorithm to efficiently

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 Programming Questions!