Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 HORNERStep 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