Question: What is the time complexity of the following code: def prob10(list): if (len(list) == 1): return list mid = len(list) // 2 return prob10(list[mid:]) +
What is the time complexity of the following code: def prob10(list):
if (len(list) == 1):
return list
mid = len(list) // 2
return prob10(list[mid:]) + prob10(list[:mid])
O(1) - Constant Time O(log2n) - Logarithmic Time
O(n) - Linear Time O(n x log2n) - "n log n" Time
O(n2) - Quadratic Time (often just call "n-squared")
O(n3) - Cubic Time (often just call "n-cubed")
O(2n) - Exponential Time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
