Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5. (20 points) Compare two algorithms: Exercise 13, p. 230 (conventional algorithm), and Exercise 14, p. 230 (Horner's method). . A pseudocode for the conventional
5. (20 points) Compare two algorithms: Exercise 13, p. 230 (conventional algorithm), and Exercise 14, p. 230 (Horner's method). . A pseudocode for the conventional algorithm for evaluating a polynomial anz" +an-lz"- procedure polynomial(c, ao, a1,..., an : real numbers) p := 1 {power} for i := 1 to n p:= p*c y := y + ai*p return y . A pseudocode called Horner's method for evaluating a polynomial anan-1"-1+...+a1r+ao procedure Horner(c, ao, a1,a2,... . an: real numbers) 72 for i := 1 to n return y (a) Evaluate 3x2 + x + 1 at x = 2 by working through each step of the conventional and Horner's algorithms showing the values assigned at each step. (b) Exactly how many multiplications and additions are used by the conventional and the Horner's algorithm to evaluate a polynomial of degree n at r - c. Express the number of multiplications and additions as a function of n. (Do not count additions used to increment the loop variable.) (c) Classify the algorithms for evaluating polynomials using big-O asymptotic notation
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started