Question: # You may assume n is an integer >= 0 def f(n): while n > 0: for i in range(n): print(i) n = n -



# You may assume n is an integer >= 0 def f(n): while n > 0: for i in range(n): print(i) n = n - 1 O(1) Ollog n) O(n) O(n log n) Q(n^2) O(n^3) 0(2^n) # You may assume n is an integer >= 0 def f(n): if n > 100: return 0 else: return f(n+1) O(1) Odlog n) O(n) On log n) O(n^2) O O(n^3) O O(2^n) # you may assume s is a string containing n characters def f(s): x = len(s) y = s while x > 0: S = y while len(s) > 0: S = s[:len(s)//2] x = x - 1 O(1) Ollog n) Q(n) O(n log n) O(n^2) O(n^3) O(2^n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
