first mid end theseq the two virtual subsequences are merged into the temporary array tmparray the elements are copied from the temporary array back into the original sequence theseq figure temporary array is used to merge two virtual subsequences requires not only the sequence structure but also the index markers and temporary array these extra arguments may not be as intuitive to the user as simply passing the sequence to be sorted in additionwhat happens if the user supplies incorrect range values or the temporary array is not large enough to merge the largest subsequencea better approach is to provide wrapper function for recmergesort(such as the one shown in listing the mergesort(function provides simpler interface as it only requires the array or list to be sorted the wrapper function handles the creation of the temporary array needed by the merge sort algorithm and initiates the first call to the recursive function listing wrapper function for the new implementation of the merge sort algorithm sorts an array or list in ascending order using merge sort def mergesorttheseq ) lentheseq create temporary array for use when merging subsequences tmparray arrayn call the private recursive merge sort function recmergesorttheseq - tmparray efficiency analysis we provided two implementations for the merge sort algorithmone that can only be used with lists and employs the slice operationand another that can be used with arrays or lists but requires the use of temporary array in merging virtual