Question: Exercise 5 . While studying hash tables, we implemented a version of Horner's rule for evaluating a polynomial in our lecture notes. Essentially, we have

Exercise 5. While studying hash tables, we implemented a version of Horner's rule for evaluating a polynomial in our lecture notes. Essentially, we have a polynomial of the form
anxn+an-1xn-1+dots+a2x2+a1x+a0
and we want to compute its value for a given x. Implement a recursive version of the Horner's rule in C++. You need to implement:
A function horner that
takes a vector where the coefficients a0,a1,dots,an are stored, an int variable n for the degree of the polynomial, and a double variable x.
computes the polynomial above for the given value of x and returns it
A main function that reads the parameters n,x, and the n coefficients, makes a call to horner, and prints the output of evaluation.
Note: Full mark is only given to working codes.
[10 points]
 Exercise 5. While studying hash tables, we implemented a version of

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!