Question: Consider the summation that is computed for x and n as inputs: S(x, n) = 1 + x + x + x + +x
Consider the summation that is computed for x and n as inputs: S(x, n) = 1 + x + x + x + +x" **** (i-15 pts) Rewrite the above summation in such a way that you can compute S(x, n) using the values of x and S(x, n-1) Note that S(x, n-1) = 1 + x + x + x +..... +xn-1 (ii- 20 pts) Use (i) to develop an iterative algorithm to compute S(x, n) using only 'n' multiplications and 'n' additions overall. Write the pseudo code. (iii-15 pts) Identify the basic operation in (ii) and use the mathematical (iterative formulae) approach discussed in class to show that overall time complexity (in terms of the number of times the basic operation is executed) for the iterative algorithm of (ii) is O(n). (iv - 10 pts) Show (manually) the iteration-wise working of your algorithm (ii) to compute S(10, 3); i.e., for x = 10 and n = 3
Step by Step Solution
There are 3 Steps involved in it
The image contains a multipart question about a summation function Sx n 1 x x2 x3 ldots xn and asks ... View full answer
Get step-by-step solutions from verified subject matter experts
