arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1505.00558cs.DScs.PF
收藏

三态QuickSort,C/C ++库qsort的替代品

Triple State QuickSort, A replacement for the C/C++ library qsort

Ammar Muqaddas

摘要:

提出了一种工业级快速排序函数及其新算法。与其他4个著名的快速排序实现相比,新算法在大多数情况下减少了比较和交换的数量,同时在最坏的情况下保持接近4个中最好的。我们用空间换取性能,在最坏的情况下,代价是n/2个临时的额外空间。运行时间测试显示,与其他4个函数的整体最佳值相比,整体性能至少提高了15.8%。此外,与Yaroslavskiy的新Dual Pivot Quicksort相比,我们的函数的运行时间提高了32.7%。我们的函数是基于指针的,这意味着可以替代C/C++库qsort()。但我们也提供了一个数组为基础的功能相同的算法,方便移植到不同的程序设计语言。

英文摘要:

An industrial grade Quicksort function along with its new algorithm is presented. Compared to 4 other well known implementations of Quicksort, the new algorithm reduces both the number of comparisons and swaps in most cases while staying close to the best of the 4 in worst cases. We trade space for performance, at the price of n/2 temporary extra spaces in the worst case. Run time tests reveal an overall improvement of at least 15.8% compared to the overall best of the other 4 functions. Furthermore, our function scores a 32.7% run time improvement against Yaroslavskiy's new Dual Pivot Quicksort. Our function is pointer based, which is meant as a replacement for the C/C++ library qsort(). But we also provide an array based function of the same algorithm for easy porting to different programming languages.

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

↑