arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2505.13552cs.DS
收藏

新型排序算法波排序(W-Sort)

New Sorting Algorithm Wave Sort (W-Sort)

University of California, Davis(加州大学戴维斯分校)

Jia Xu Wei

AI总结:

波排序是一种新型原地排序算法,通过动态主元选择策略解决传统排序算法的性能问题,具有高效的比较复杂度和稳定的性能表现。

摘要:

现代比较排序算法如快速排序由于劣质的主元选择导致性能不一致,导致最坏情况复杂度为(O(N²))。而原地归并排序变体则面临数据移动开销的挑战。我们引入了波排序,一种新的原地排序算法,通过动态主元选择策略来解决这些限制。波排序通过逐步扩展已排序区域,并从该增长的已排序部分中选择主元来划分相邻的无序数据。这种方法确保了无论数据集大小如何,都能实现稳健的主元选择,保证了对数递归栈深度,并实现了高效的原地排序。我们的分析显示,最佳比较复杂度为(N-1),平均比较复杂度接近(log₂(N)!),最坏情况比较复杂度被限制在(O(N(log(N))²))以内,具有小的常数因子,这可以减少到(O(N log N))通过混合排序。该算法可以轻松扩展以与其他排序算法混合。实验结果表明,波排序在平均情况下所需的比较次数显著少于快速排序(大约少24%),并且接近理论最小值(log₂(N)!)。波排序为需要一致、可预测和原地排序性能的应用提供了有吸引力的替代方案。

英文摘要:

Modern comparison sorts like quicksort suffer from performance inconsistencies due to suboptimal pivot selection, leading to $(O(N^2))$ worst-case complexity, while in-place merge sort variants face challenges with data movement overhead. We introduce Wave Sort, a novel in-place sorting algorithm that addresses these limitations through a dynamic pivot selection strategy. Wave Sort iteratively expands a sorted region and selects pivots from this growing sorted portion to partition adjacent unsorted data. This approach ensures robust pivot selection irrespective of dataset size, guarantees a logarithmic recursion stack depth, and enables efficient in-place sorting. Our analysis shows a best comparison complexity of $(N-1)$, average comparison complexity close to $(\log_2(N)!)$, and worst-case comparison complexity bounded by $(O(N(\log(N))^2))$ with a small constant factor, which could be reduced to $(O(N\log(N)))$ with hybrid sorting. The algorithm can be easily expanded to be hybridized with other sorting algorithms. Experimental results demonstrate that Wave Sort requires significantly fewer comparisons than quicksort on average (approximately 24% less) and performs close to the theoretical minimum $(\log_2(N)!)$. Wave Sort offers a compelling alternative for applications demanding consistent, predictable, and in-place sorting performance.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑