首页> 外文期刊>Software >Building a new sort function for a C library
【24h】

Building a new sort function for a C library

机译:为C库构建新的排序功能

获取原文
获取原文并翻译 | 示例
       

摘要

Up to now, the most efficient sort function for a C library was a variant of Hoare's Quicksort (qsort, for short), which was proposed by Bentley and McIlroy in the early 1990s. Here we call this library function BM qsort. This paper introduces a library function which is based on Chen's Proportion Extend Sort (psort). This work is inspired by the fact that psort is generally faster than qsort, and in the worst case, qsort requires O(n~2) comparisons, while psort requires O(n log n). In our library function, many tricks used in BM qsort have been adopted, such as sorting a small array by an insertion sort and the handling of equal elements. Some new tricks are also proposed, however, such as the adaptive partitioning scheme. To assess more effectively the behavior of our function, the test cases are enhanced. The empirical results show that our function is robust and faster than BM qsort. On particular classes of inputs, such as 'already sorted', it is linear time.
机译:到目前为止,C库最有效的排序功能是Hoare的Quicksort(简称qsort)的一种变体,它是Bentley和McIlroy在1990年代初提出的。在这里,我们将此库函数称为BM qsort。本文介绍了一种基于Chen的Proportion Extend Sort(psort)的库函数。这项工作的灵感来自于psort通常比qsort快,并且在最坏的情况下,qsort需要O(n〜2)比较,而psort需要O(n log n)。在我们的库函数中,采用了BM qsort的许多技巧,例如通过插入排序对小数组进行排序以及对相等元素的处理。但是,还提出了一些新的技巧,例如自适应分区方案。为了更有效地评估我们的行为,测试用例得到了增强。实证结果表明,我们的函数比BM qsort健壮且速度更快。在特定的输入类别上,例如“已经排序”,它是线性时间。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号