【24h】

Sorting by Merging or Merging by Sorting?

机译:通过合并排序还是通过排序合并?

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

摘要

In the comparison model the only operations allowed on input elements are comparisons and moves to empty cells of memory. We prove the existence of an algorithm that, for any set of s ≤ n sorted sequences containing a total of n elements, computes the whole sorted sequence using O(n log s) comparisons, O(n) data moves and O(1) auxiliary cells of memory besides the ones necessary for the n input elements. The best known algorithms with these same bounds are limited to the particular case s = O(1). Prom a more intuitive point of view, our result shows that it is possible to pass from merging to sorting in a seamless fashion, without losing the optimality with respect to any of the three main complexity measures of the comparison model. Our main statement has an implication in the field of adaptive sorting algorithms and improves [Franceschini and Geffert, Journal of the ACM, 52], showing that it is possible to exploit some form of pre-sortedness to lower the number of comparisons while still maintaining the optimality for space and data moves. More precisely, let us denote with Opt_M (X) the cost for sorting a sequence X with an algorithm that is optimal with respect to a pre-sortedness measure M. To the best of our knowledge, so far, for any pre-sortedness measure M, no full-optimal adaptive sorting algorithms were known (see [Estivill-Castro and Wood, ACM Comp. Surveys, 24], page 472). The best that could be obtained were algorithms sorting a sequence X using O(1) space, O(Opt_M(X)) comparisons and O(Opt_M(X)) moves. Hence, the move complexity seemed bound to be a function of M(X) (as for the comparison complexity). We prove that there exists a pre-sortedness measure for which that is false: the pre-sortedness measure Runs, defined as the number of ascending contiguous subsequences in a sequence. That follows directly from our main statement, since Opt_M(X) = O(∣X∣ log Runs(X)).
机译:在比较模型中,对输入元素唯一允许的操作是比较,并移至空的存储器单元中。我们证明了一种算法的存在,对于任何包含总共n个元素的s≤n个排序序列的任何集合,都使用O(n log s)个比较,O(n)个数据移动和O(1)计算整个排序的序列辅助存储单元,除了n个输入元素所需的存储单元之外。具有这些相同范围的最著名算法仅限于特定情况s = O(1)。从更直观的观点出发,我们的结果表明,可以以无缝的方式从合并过渡到排序,而不会丢失比较模型的三个主要复杂度度量中的任何一个的最优性。我们的主要声明对自适应排序算法领域有影响,并对其进行了改进[Franceschini和Geffert,ACM杂志,52],表明可以利用某种形式的预排序来降低比较数,同时仍保持空间和数据移动的最优性。更准确地说,让我们用Opt_M(X)表示使用相对于预排序度量M最佳的算法对序列X进行排序的成本。到目前为止,就我们所知,对于任何预排序度量M,尚无全最佳的自适应分类算法(请参阅[Estivill-Castro and Wood,ACM Comp。Surveys,24],第472页)。可以获得的最佳结果是使用O(1)空间,O(Opt_M(X))比较和O(Opt_M(X))移动对序列X进行排序的算法。因此,移动复杂度似乎必然是M(X)的函数(至于比较复杂度)。我们证明存在一个错误的预排序量度:预排序量度Run,定义为序列中连续的连续子序列数。由于Opt_M(X)= O(∣X∣ log Runs(X)),因此直接从我们的主要声明中得出。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号