Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago