We give a more space-efficient implementation of adaptive mergesort: Virtual-Memory Powersort. Using internal buffering techniques, we significantly reduce the memory consumption of the algorithm; specifically, for sorting $n$ objects the required buffer area is reduced from space for $n/2$ objects to $O(\sqrt{n \log n})$ objects. While this space-efficiency can be achieved (indeed reduced to $O(1)$) conceptually very easily with known inplace merging algorithms, using these as a drop-in replacement for the standard merge algorithm incurs a substantial slow-down. Virtual-Memory Powersort, by contrast, uses the same number of moves and comparisons as previous Powersort implementations up to an additive $O(n)$ term. We report on an empirical running-time study comparing our implementation against other Powersort variants and state-of-the-art stable sorting methods, demonstrating that almost in-place stable sorting can be achieved with negligible overhead in many scenarios.


翻译:我们提出了一种更节省空间的自适应归并排序实现:虚拟内存Powersort。通过采用内部缓冲技术,我们显著降低了该算法的内存消耗;具体而言,对于排序$n$个对象,所需缓冲区空间从$n/2$个对象的空间减少至$O(\sqrt{n \log n})$个对象。虽然这种空间效率(实际上可降至$O(1)$)在概念上可以通过已知的就地归并算法非常简易地实现,但直接将此类算法作为标准归并算法的替代品会带来显著的性能下降。相比之下,虚拟内存Powersort在移动次数和比较次数上与先前的Powersort实现保持一致,仅存在一个$O(n)$项的额外增量。我们报告了一项实证运行时间研究,将我们的实现与其他Powersort变体及最先进的稳定排序方法进行对比,证明在众多场景下,几乎无需额外开销即可实现近乎原地的稳定排序。

0
下载
关闭预览

相关内容

【ICML 2024】零阶优化器微调大模型,大幅降低内存
专知会员服务
32+阅读 · 2024年7月8日
走向通用虚拟智能体
专知会员服务
76+阅读 · 2023年11月26日
专知会员服务
29+阅读 · 2021年2月26日
【资源】深度学习模型压缩资源汇总
专知
38+阅读 · 2019年5月8日
Colab 免费提供 Tesla T4 GPU,是时候薅羊毛了
机器之心
10+阅读 · 2019年4月25日
自己动手撸一个分布式IM(即时通讯) 系统
51CTO博客
16+阅读 · 2019年3月20日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 5月13日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
7+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
7+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
6+阅读 · 6月17日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员