NEW HERE? USE "AFORUM20" TO GET GET 20 % OFF CLAIM OFFER

UK: +44 748 007-0908 USA: +1 917 810-5386
My Orders
Register
Order Now

Pseudo code design for a recursive algorithm

This question is concerned with the design and analysis of recursive algorithms. You are given a problem statement as shown below. This problem is concerned with performing calculations on a sequence it of real numbers. Whilst this could be done using a conventional loop-based approach, your answer must be developed using a recursive algorithm. No marks will be given if your answer uses loops. FindAverageAndSum(az,...,a,) Input: A sequence of real values A = (al, an). Output:. A 2-tuple (average, sum) containing the average (average) of all the values and the sum (sum) of all the values of the elements in A. Your recursive algorithm should use a single recursive structure to find the average and sum values. and should not use two separate instances of a recursive design. You should not employ any global variables. (a) Produce a pseudo code design for a recursive algorithm to solve this problem. (b) Draw a call-stack diagram to show the application of your recursive algorithm when called using the sequence = (12,8, -4,3, -6, -1). (c) Write down the set of recurrence equations for your recursive algorithm. Remember that one of the equations should correspond to the recursive algorithm base case. (d) Using the recurrence equations you gave in your answer for part (c), determine the running time complexity of your recursive algorithm.