When an input is an array, clarification whether the array is a sorted or unsorted is a critically important time complexity assumption to question/clear.
Merge sort has Big O
= Big Omega
= Big Theta
of O(n log n)
.
Sum of all comparison (n-1) + (n-2) + (n-3) + …+1
is n*(n-1)/2
.
O(n^2)
.Is the array sorted? What is the element types of the array? Is there an empty or null value in the array?