最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

使用合并排序算法就地如何排序?

SEO心得admin85浏览0评论
本文介绍了使用合并排序算法就地如何排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道这个问题是不是太具体。

I know the question is not too specific.

我要的是有人来告诉我如何转换成一个正常的合并排序为就地合并排序(或归并排序恒额外的空间开销)。

All I want is someone to tell me how to convert a normal merge sort into an in-place merge sort (or a merge sort with constant extra space overhead).

所有我能找到(网上)是网页说:实在是太复杂或出了本文的范围。

All I can find (on the net) is pages saying "it is too complex" or "out of scope of this text".

唯一已知的方式来合并就地(没有任何额外的空间)太复杂,无法减小到实用程序。 (从这里采取)

The only known ways to merge in-place (without any extra space) are too complex to be reduced to practical program. (taken from here)

即使是太复杂了,什么是如何使合并排序的基本概念原地?

推荐答案

具体包括大的结果,本文介绍了几个就地合并排序(PDF)的变体:

Including its "big result", this paper describes a couple of variants of in-place merge sort (PDF):

citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.22.5514&rep=rep1&type=pdf

就地与动作较少排序的

Jyrki Katajainen,托米A.帕萨宁

Jyrki Katajainen, Tomi A. Pasanen

结果表明,n的阵列   元素可以使用Ø进行排序(1)   额外的空间,O(N日志N / log日志N)   元素时,和n日志2 N + O(N日志   log n)的比较。这是第一个   就地排序算法要求   O(N log n)的移动在最坏的情况下,   同时保证为O(n log n)的   比较,但由于不断   因素所涉及的算法   理论上的意义predominantly。

It is shown that an array of n elements can be sorted using O(1) extra space, O(n log n / log log n) element moves, and n log 2 n+O(n log log n) comparisons. This is the first in-place sorting algorithm requiring o(n log n) moves in the worst case while guaranteeing O(n log n) comparisons, but due to the constant factors involved the algorithm is predominantly of theoretical interest.

我觉得这是相关的了。我有它的打印输出躺在身边,传递给我的一个同事,但我没有看到它。它似乎涵盖基础理论,但我不熟悉不够的话题,如何判断COM prehensively:

I think this is relevant too. I have a printout of it lying around, passed on to me by a colleague, but I haven't read it. It seems to cover basic theory, but I'm not familiar enough with the topic to judge how comprehensively:

comjnl.oxfordjournals/cgi/content/abstract/38/8/681

最优稳定合并的

安东尼奥斯Symvonis

Antonios Symvonis

本文介绍了如何稳定合并   两个序列A和大小M B和   N,M≤N,分别与O(M + N)   分配,O(MLOG(N / M + 1))   比较和只使用一个恒定   量的附加空间。本   结果匹配,所有已知的下限...

This paper shows how to stably merge two sequences A and B of sizes m and n, m ≤ n, respectively, with O(m+n) assignments, O(mlog(n/m+1)) comparisons and using only a constant amount of additional space. This result matches all known lower bounds...

发布评论

评论列表(0)

  1. 暂无评论