Question: Consider the following algorithm: 1 . def mystery _ algorithm ( n ) : 2 . result = 0 3 . i = 1 4
Consider the following algorithm:
def mysteryalgorithmn:
result
i
while i n:
j i
while j n:
result
j
i
return result
Prove the overall time complexity of the mysteryalgorithm function in BigO notation.
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
