Question: please answer this question Problem i. Consider the problem of evaluating a polynomial The input is defined by a value x and a polynomial p

 please answer this question Problem i. Consider the problem of evaluating

please answer this question

Problem i. Consider the problem of evaluating a polynomial The input is defined by a value x and a polynomial p represented as an array A ao, a1, of coefficients. The output should be p(x) Assuming each addition and multiplication takes O(1) time, you are to analyze the complexity of two algorithms for this task. The first one, is a naive strategy that computes each term of the polynomial from scratch. 1: function NAIVE(x, A) 2: answer =0 length of A for i from 0 to n do 3 4: 5: 6: for j from 1 toi do aux = aux * x answer answerauxAi 9. return answe The second one, is based on Horner's rule for polynomial evaluation. 1: function HORNER(x,A) 2 nswer 0 3 length of A 4: for i from n to 0 do answer = A[i] + answer * x return answer 6: a) Using O-notation, upperbound the running time of NAIvE b) Using -notation, lowerbound the running time of NAIvE to show that your upperbound is in fact asymptotically tight. c) Using O-notation, upperbound the running time of HORNER

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!