Question: Write the Big - O notation next to the function for each subquestion below. a . # Assume s is a string with n characters
Write the BigO notation next to the function for each subquestion below.
a
# Assume s is a string with n characters
def fs:
if s :
return
prints:lens
return fs:lens
b
# Assume s is a string with n characters
def fs:
x lens
y s
while x :
s y
while lens:
s s:lens
x x
c
# Assume n is a positive integer
def fn:
for i in rangen:
printi
for j in rangen:
printj
for k in range:
printk
d
# Assume aList is list containing n items
def faList:
for i in rangelenaList:
for j in rangei:
printi j
e
# Assume n is a positive integer
def fn:
if n :
return fn
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
