Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started