Question: pseudo code for C++ and No Iterative algorithms please Develop a recursive algorithm to determine the sum of the first n integers ( (i.e., S(n)=1+2+3++
Develop a recursive algorithm to determine the sum of the first n integers ( (i.e., S(n)=1+2+3++ n ), where ' n ' is the input to the algorithm. The time complexity of the recursive algorithm should be (n) with respect to 'addition' as the basic operation. Tasks: 1) Write a pseudo code for the recursive algorithm you come up with. 2) Write the recurrence relation to compute S(n) as well as the terminating condition. 3) Provide an explanation or a derivation to show that the recursive algorithm of (1) uses the recurrence relation mentioned in (2) and justify that it does work as intended. 4) Write the recurrence relation (as well as the terminating condition) for the number of additions A(n) done in (12) and solve the recurrence relation to show that A(n)=(n). Note: You will get a ZERO for the question if you provide an iterative algorithm as your solution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
