Ems:一种增强的归并排序算法,对已经排序的部分进行早期检查

Mutaz Rasmi Abu Sara, M. F. J. Klaib, M. Hasan
{"title":"Ems:一种增强的归并排序算法,对已经排序的部分进行早期检查","authors":"Mutaz Rasmi Abu Sara, M. F. J. Klaib, M. Hasan","doi":"10.15282/ijsecs.5.2.2019.2.0058","DOIUrl":null,"url":null,"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.","PeriodicalId":31240,"journal":{"name":"International Journal of Software Engineering and Computer Systems","volume":"69 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2019-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"EMS: AN ENHANCEDMERGE SORT ALGORITHMBY EARLY CHECKING OF ALREADY SORTED PARTS\",\"authors\":\"Mutaz Rasmi Abu Sara, M. F. J. Klaib, M. Hasan\",\"doi\":\"10.15282/ijsecs.5.2.2019.2.0058\",\"DOIUrl\":null,\"url\":null,\"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.\",\"PeriodicalId\":31240,\"journal\":{\"name\":\"International Journal of Software Engineering and Computer Systems\",\"volume\":\"69 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2019-08-30\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"International Journal of Software Engineering and Computer Systems\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.15282/ijsecs.5.2.2019.2.0058\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"International Journal of Software Engineering and Computer Systems","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.15282/ijsecs.5.2.2019.2.0058","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

归并排序是一种渐近最优排序算法,广泛应用于编程语言库函数和操作系统中。在本文中,我们给出了一个改进版本的归并排序,在实践中,它比经典的自顶向下和自底向上的归并排序在运行时间上有了很大的改进。我们的算法采用自底向上的方式工作,修改发生在三个地方:(a)给定数组中的n个元素,首先算法将数组视为n / 2个连续的对,并对每对进行一次比较;(b)在后续步骤中,在两个子数组的“合并”过程中,如果左子数组的最后一个元素小于右子数组的第一个元素,则算法简单返回;(c)如果右子数组中的最后一个元素小于左子数组中的第一个元素,则算法将两个子数组中的元素全部交换。步骤(b)和(c)就地进行。对于不在(b)或(c)中的情况,算法遵循经典的合并技术,并添加一个额外的数组。我们的实验结果还表明,情况(b)和(c)在实践中发生的时间很长,这就是我们的算法比经典归并排序提供更好运行时间的原因。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
EMS: AN ENHANCEDMERGE SORT ALGORITHMBY EARLY CHECKING OF ALREADY SORTED PARTS
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.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
14
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信