Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Is company e-mail private?

Answered: 1 week ago