Question: Hi, Im doing runtime analysis exercises. Im having trouble with questions c and d. For d, Im confused by the recursive call insdie the while

 Hi, Im doing runtime analysis exercises. Im having trouble with questionsc and d. For d, Im confused by the recursive call insdie

Hi, Im doing runtime analysis exercises. Im having trouble with questions c and d. For d, Im confused by the recursive call insdie the while loop, how do you turn tthat into a closed form. I don't need a and b as ive already done those.

13. Analyse the runtime of each of the following recursive algorithms. It's up to you to decide whether you should use repeated substitu- tion or the Master Theorem to find the asymptotic bound. 1 def sum(A) 2 if len (A) 9 return1 4 else: 5 return A[0sum(AI1. len (A)-1]) 1 def fun (A) 2 if len (A) 2: 3 return len(A) 4 4 else 5 return fun(A[2. len (A)-1]) 1 def double fun(A): n = len (A) return n 5 else 4 6 return double fun(AIe. .n-2])double fun(A[1..n-1]) 13. Analyse the runtime of each of the following recursive algorithms. It's up to you to decide whether you should use repeated substitu- tion or the Master Theorem to find the asymptotic bound. 1 def sum(A) 2 if len (A) 9 return1 4 else: 5 return A[0sum(AI1. len (A)-1]) 1 def fun (A) 2 if len (A) 2: 3 return len(A) 4 4 else 5 return fun(A[2. len (A)-1]) 1 def double fun(A): n = len (A) return n 5 else 4 6 return double fun(AIe. .n-2])double fun(A[1..n-1])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!