in Algorithms
1,353 views
1 vote
1 vote
in Algorithms
1.4k views

9 Comments

No, merge sort has an upper bound of $O(n \log n)$
0
0
I think it will be θ(nlogn),O(nlogn) which is also equal to O(n^2)..it will be never be θ(n^2)
0
0
Yes time complexity can be $O(n^2)$ if you use merge sort with inplace.
1
1
The time complexity of Merge sort is (nlogn) for all three cases i.e best, average and worst case.
0
0
Yes it can be O(n$^{2}$) in case of in-place, when data structure used is array.

Otherwise in case of linked list it will be O(nlogn) only.
0
0

@aambazinga in case of inplace with linked list it should take $O(n^2)$ time. Right?

0
0

@Shubhanshu no it's O[nlogn] see this it will be clear. https://www.geeksforgeeks.org/merge-sort-for-linked-list/

0
0
Thanks.

By default MS on LL is inplace only. But on array it is outplace.
0
0
What's in place and out place in merge sort?
0
0

Please log in or register to answer this question.

Related questions