Question: 10. An alternative to the polynomial evaluation algorithm in Exercise 9 is an algorithm called Horner s method. Horner's method relies on an alternative expression



10. An alternative to the polynomial evaluation algorithm in Exercise 9 is an algorithm called Horner s method. Horner's method relies on an alternative expression for a polynomial, for example 23 72 5x 1414x(5(2 214 Recursion, Recurrence Relations, and Analysis of Algorithms Horner(real a, real a,-I... , real ao, real c, integer n) //evaluates polynomial a,a,"-+ao forxc //using Horner's method Local variables integer i real result = an fori to n do resultresultct a-i end for return result end function Horner 10 involve evaluating a polynomial a a-1+ ao for a specific value ofx. Exercises 9 and 10 involve evaluating a polynomial aa-ao for a specific value of x 9. A straightforward algorithm to evaluate a polynomial is given by the following function: Poly(real a, real a-. real ao, real c, integer n) //evaluates polynomial arr" + an-lx"- + + ao Local variables integer i real sum ao real product = 1 for x = c for i I to n do product = product * c sum = sum + a.* product end for return Sunn end function Poly a. Walk through this algorithm to compute the value of 2x3-7x2 + 5x-14 for x 4 b. The algorithm involves both additions and multiplications; analyze this algorithm where those operations are the work units
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
