Question: 3 . ( 1 0 pt . ) Consider the following algorithm, which takes as input an array A: def printStuff ( A ) :

3.(10 pt.) Consider the following algorithm, which takes as input an array A:
def printStuff(A):
n = len(A)
if n <=4:
return
for i in range(n):
print(A[i])
printStuff(A[:n/3]) # recurse on first n/3 elements of A
printStuff(A[2*n/3:]) # recurse on last n/3 elements of A
return
What is the asymptotic running time of printStuff?
[We are expecting: The best answer you can give of the form The running time of
printStuff is O() and a short explanation.]
3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!