Adaptive Shivers Sort: An Alternative Sorting Algorithm

IF 0.9 3区 计算机科学 Q3 COMPUTER SCIENCE, THEORY & METHODS ACM Transactions on Algorithms Pub Date : 2024-05-22 DOI:10.1145/3664195
Vincent Jugé
{"title":"Adaptive Shivers Sort: An Alternative Sorting Algorithm","authors":"Vincent Jugé","doi":"10.1145/3664195","DOIUrl":null,"url":null,"abstract":"<p>We present a new sorting algorithm, called adaptive ShiversSort, that exploits the existence of monotonic runs for sorting efficiently partially sorted data. This algorithm is a variant of the well-known algorithm TimSort, which is the sorting algorithm used in standard libraries of programming languages such as Python or Java (for non-primitive types). More precisely, adaptive ShiversSort is a so-called \\(k\\)-aware merge-sort algorithm, a class that captures “TimSort-like” algorithms and that was introduced by Buss and Knop.</p><p>In this article, we prove that, although adaptive ShiversSort is simple to implement and differs only slightly from TimSort, its computational cost, in number of comparisons performed, is optimal within the class of <i>natural</i> merge-sort algorithms, up to a small additive linear term. This makes adaptive ShiversSort the first \\(k\\)-aware algorithm to benefit from this property, which is also a 33% improvement over TimSort’s worst-case. This suggests that adaptive ShiversSort could be a strong contender for being used instead of TimSort.</p><p>Then, we investigate the optimality of \\(k\\)-aware algorithms. We give lower and upper bounds on the best approximation factors of such algorithms, compared to optimal stable natural merge-sort algorithms. In particular, we design generalisations of adaptive ShiversSort whose computational costs are optimal up to arbitrarily small multiplicative factors.</p>","PeriodicalId":50922,"journal":{"name":"ACM Transactions on Algorithms","volume":"30 1","pages":""},"PeriodicalIF":0.9000,"publicationDate":"2024-05-22","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"ACM Transactions on Algorithms","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1145/3664195","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, THEORY & METHODS","Score":null,"Total":0}
引用次数: 0

Abstract

We present a new sorting algorithm, called adaptive ShiversSort, that exploits the existence of monotonic runs for sorting efficiently partially sorted data. This algorithm is a variant of the well-known algorithm TimSort, which is the sorting algorithm used in standard libraries of programming languages such as Python or Java (for non-primitive types). More precisely, adaptive ShiversSort is a so-called \(k\)-aware merge-sort algorithm, a class that captures “TimSort-like” algorithms and that was introduced by Buss and Knop.

In this article, we prove that, although adaptive ShiversSort is simple to implement and differs only slightly from TimSort, its computational cost, in number of comparisons performed, is optimal within the class of natural merge-sort algorithms, up to a small additive linear term. This makes adaptive ShiversSort the first \(k\)-aware algorithm to benefit from this property, which is also a 33% improvement over TimSort’s worst-case. This suggests that adaptive ShiversSort could be a strong contender for being used instead of TimSort.

Then, we investigate the optimality of \(k\)-aware algorithms. We give lower and upper bounds on the best approximation factors of such algorithms, compared to optimal stable natural merge-sort algorithms. In particular, we design generalisations of adaptive ShiversSort whose computational costs are optimal up to arbitrarily small multiplicative factors.

查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
自适应 Shivers 排序:另一种排序算法
我们提出了一种名为自适应 ShiversSort 的新排序算法,它利用单调运行的存在对部分排序数据进行高效排序。该算法是著名算法 TimSort 的变种,TimSort 是 Python 或 Java(非原始类型)等编程语言标准库中使用的排序算法。更确切地说,自适应 ShiversSort 是一种所谓的(k\)-aware 合并排序算法,该类算法捕捉了 "类似 TimSort "的算法,是由 Buss 和 Knop 提出的。在本文中,我们将证明,虽然自适应 ShiversSort 实现简单,与 TimSort 也仅有微小差别,但其计算成本(以执行的比较次数计算)在自然合并排序算法中是最优的,最多只有很小的加法线性项。这使得自适应 ShiversSort 成为第一个受益于这一特性的 \(k\)-aware 算法,与 TimSort 的最坏情况相比,它也提高了 33%。这表明,自适应 ShiversSort 可以成为取代 TimSort 的有力竞争者。然后,我们研究了 \(k\) -aware 算法的最优性。与最优的稳定自然合并排序算法相比,我们给出了这类算法最佳近似因子的下限和上限。特别是,我们设计了自适应 ShiversSort 的广义算法,其计算成本在任意小的乘法因子范围内都是最优的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
ACM Transactions on Algorithms
ACM Transactions on Algorithms COMPUTER SCIENCE, THEORY & METHODS-MATHEMATICS, APPLIED
CiteScore
3.30
自引率
0.00%
发文量
50
审稿时长
6-12 weeks
期刊介绍: ACM Transactions on Algorithms welcomes submissions of original research of the highest quality dealing with algorithms that are inherently discrete and finite, and having mathematical content in a natural way, either in the objective or in the analysis. Most welcome are new algorithms and data structures, new and improved analyses, and complexity results. Specific areas of computation covered by the journal include combinatorial searches and objects; counting; discrete optimization and approximation; randomization and quantum computation; parallel and distributed computation; algorithms for graphs, geometry, arithmetic, number theory, strings; on-line analysis; cryptography; coding; data compression; learning algorithms; methods of algorithmic analysis; discrete algorithms for application areas such as biology, economics, game theory, communication, computer systems and architecture, hardware design, scientific computing
期刊最新文献
Deterministic Replacement Path Covering On the complexity of symmetric vs. functional PCSPs Scattering and Sparse Partitions, and their Applications Quantum Speed-ups for String Synchronizing Sets, Longest Common Substring, and \(k\) -mismatch Matching On Computing the \(k\) -Shortcut Fréchet Distance
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1