Question: please answer all questions accurately, I will rate correct answers thanks Exercise 2 (60 points) Analyze A Silly Algorithm 1. Consider the problem to compute
please answer all questions accurately, I will rate correct answers thanks


Exercise 2 (60 points) Analyze A Silly Algorithm 1. Consider the problem to compute the sum Er-o ax' where x and x are real numbers with o Sxs 1. Below is a silly (naive and inefficient) algorithm A to compute the sum I?-o ax'. ComputeSumPowers (a,x,n) inputs: x is a real number with 0 1) output: a real number equal to X?=o axi 1: sum = 0 2: for i = 0 ton 3: prod = 1 4: for j = 1 to i 5: prod = a * prod * x sum +prod 7: return sum All the questions in this exercise are related to the computeSumPowers (a,x,n) algorithm. The objective of this exercise is to explore whether the asymptotic time complexity will change if we count different "actions". OYUN .. 6: Sum= C) (24 points) Multiplication () Action In this case, we count the total number of multiplications performed by the execution of the algorithm. Answer the following questions to determine the total number of multiplications during the execution of the algorithm a. (18 points) Let us call ai the number of multiplications performed for a given value of i. Fill in this table (Justify how you find ai only for i= 1 and i=n): ai N 3 n b. (5 points) Express the function fu(n) that represents the overall total number of multiplications performed during the execution of the algorithm. C. (1 point) The function fou(n) grows like
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
