2. What is the running time, T(n), for the below code? Describe how you arrived at the answer
(which part of the code correspond to the terms in T(n) and why). Determine the asymptotic
upper bound. What is C, no in your upper bound? Plot n vs T(n) and Upper bound in the
same graph for n = 1000 to 5000, in increments of 1000. [15 points]
def random_func1(list1, list2):
x = 0
g = 0
while(x < len(list1) + len(list2)):
for i in range(len(list1)):
print(list1[len(list1)-1-i])
g=g+1
y = 0
while(y < len(list2)):
print(list2[y])
y +=2
x += 1
3. What is the running time, T(n), for the below code? Describe how you arrived at the answer
(which part of the code correspond to the terms in T(n) and why). Determine the asymptotic
upper bound. What is C, no in the upper bound? Determine the asymptotic upper bound.
Plot n vs T(n) and Upper bound in the same graph for n = 10 to 1000, in increments of
10. [15 points]
for i in range(n):
for j in range(n):
for k in range(n):
k = 2 + 2