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

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 Databases Questions!