Merge Sort, Merge Sort Algorithm, Data Structures, Data Structure Algorithm, Naem Azam.
can use a flag in our code to check if the array is already sorted or not. Worst-case: In the worst-case scenario, we will divide the array into two sub-arrays and hence we will perform logn operations and we have to do this for n iterations. So in the worst case, the time complexity will be