Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. Prove by induction that the recursive function you wrote in the previous prob

ID: 3861796 • Letter: 4

Question

4. Prove by induction that the recursive function you wrote in the previous problem is correct.

1. Given the following function that evaluates a polynomial whose coefficients are stored in an array: double evaluate (double coefficients, int n, double x) double result coefficients [0] double power 1; for (int i 1; i K n; i++ power power result result coefficients li power return result; Let n be the length of the array. Determine the number of additions and multiplications that are performed in the worst case as a function of n. 2. Suppose the number of steps required in the worst case for two algorithms are as follows: Algorithm 1: fn)- 3m 5 Algorithm 2: g(n) 53n 9 Determine at what point algorithm 2 becomes more efficient than algorithm l Consider the following iterative function for problems 3 and 4 int triangular (int n) int result 0; for (int i 1; i n; i result i; return result; 3. Rewrite the function triangular using recursion and add preconditions and postconditions as comments.

Explanation / Answer

1-

In the worst case in the function of n there are n-1 number of additions and there should be (n-1) square multiplications

For other questions to be answered please provide as seprate questions

Thankyou!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote