I had this question on a test and i'm trying to understand it:
What is the time complexity of this function (in the worst case) assuming that Bubblesort() is the most optimized version of the Bubble Sort algorithm?
def MultSort(a,n):
for i in range(n):
BubbleSort(a)
The options were:
- Linear
- Quadratic
- Cubic
I was thinking that the first sort (because it's the worst case) would be O(len(a)^2) and then n*O(len(a)) once it's ordered.But i can't really get to a result by myself