Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following function, what are the asymptotic running times? Write it in asymptotic notation and justify why. (, O, ). def func1(n): x =

Given the following function, what are the asymptotic running times? Write it in asymptotic notation and justify why. (, O, ).

def func1(n):

x = 0:

for i in range(1, n//2+1):

for j in range(i, n-1 +1);

x = x*x

return x

def func2(n):

x = 0

i = 1

while(i < 5*n):

for j in range(1, i**2 +1):

x = x*i + j

i = i + 3

return x

def func3(n)

x = 0

i = 1

while(i < 3*n**7);

for j in range(1, i+1);

x = x - i*j

i = i *3

return s

def func4(seq):

n = len(seq)

x = 0

for i in range(n)

for j in range(3*(i**2)):

x+=i*i - j

return x

def func5(seq)

n = len(seq)

x = 0

for i in range(n):

u = int(4*(n**(1/2)))

for j in range(u):

x += i*i - j

return x

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

Elements Of Chemical Reaction Engineering

Authors: H. Fogler

6th Edition

013548622X, 978-0135486221

More Books

Students also viewed these Algorithms questions

Question

1. Which develops first, a neurons axon or its dendritespg105

Answered: 1 week ago