The merge function compares the elements of both sub-arrays one by one and places the smaller element into the input array. 2T(n/2) corresponds to the time required to sort the sub-arrays, and O(n) is the time to merge the entire array. When solved, the time complexity will come to O(nLogn).
The merge function compares the elements of both sub-arrays one by one and places the smaller element into the input array. 2T(n/2) corresponds to the time required to sort the sub-arrays, and O(n) is the time to merge the entire array. When solved, the time complexity will come to O(nLogn).