Exercises 36—39 refer to the following algorithm to compute the value of a real polynomial.
Algorithm 11.3.3 Term-by-Term Polynomial Evaluation
[This algorithm computes the value of a polynomial by computing each term separately, starting with , and adding it to an accumulating sum.]Input: n [a nonnegative inreger],
[an array of real numbers], x [a real number]Algorithm Body:
for to n for to i next j next i
Output: polyval [a real number] 39. Use the theorem on polynomial orders to find an order for Algorithm 11.3.3.
The order of the given algorithm 11.3.3 (Term-by-Term Polynomial Evaluation).
The order of a polynomial is given by,
If is any integer with and are real numbers with , then
To find the order of the algorithm, first we should find the total number of iterations of the loops.
Here we got a nested for-next loop and we can create a trace table to find the number of iterations.
Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!Get Started