Ems: an enhanced merge sort algorithm by early checking of already sorted parts
International Journal of Software Engineering and Computer Systems(2019)
Abstract
Merge sort is one of the asymptotically optimal sorting algorithms that is used in many places including programming language library functions and operating systems. In this paper, we give a modified version of merge sort, which in practice shows substantial improvement in running time than the top-down and bottom-up implementations of the classical merge sort. Our algorithm works as a bottom-up manner and the modifications happen in three places: (a) given n elements in an array, first the algorithm considers the array as n / 2 consecutive pairs and sorts each pair in-place by one comparison; (b) in subsequent steps, during the ”merge” process of two subarrays, if the last element in the left subarray is smaller than the first element in the right subarray, the algorithm simply returns; and (c) if the last element in the right subarray is smaller than the first element in the left subarray, then the algorithm swaps the elements in the two subarrays by their entirety. Steps (b) and (c) happen in-place. For the case not in (b) or (c), the algorithm follows the classical merge technique with an extra array. Our experimental results also show that case (b) and (c) happen a good amount of time in practice and that is the reason that our algorithm gives better running time than the classical merge sort.
MoreTranslated text
Key words
enhanced merge sort algorithm,early checking
AI Read Science
Must-Reading Tree
Example
![](https://originalfileserver.aminer.cn/sys/aminer/pubs/mrt_preview.jpeg)
Generate MRT to find the research sequence of this paper
Chat Paper
Summary is being generated by the instructions you defined