What is the Big O runtime of the following code?
Posted: Sun May 15, 2022 12:01 pm
What is the Big O runtime of the following code?
def random_loops (n): total = 0 o = for i in range(n//2): counter = 0 while counter < n: < n total += 1 counter t= 1 for j in range(n): for k in range(j,n): magic 1 while magic < n: total += 1 magic *= 2 for i in range(100): total += 1 return total
def random_loops (n): total = 0 o = for i in range(n//2): counter = 0 while counter < n: < n total += 1 counter t= 1 for j in range(n): for k in range(j,n): magic 1 while magic < n: total += 1 magic *= 2 for i in range(100): total += 1 return total