Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 位置感知合并排序_Performance_Algorithm_Sorting - Fatal编程技术网

Performance 位置感知合并排序

Performance 位置感知合并排序,performance,algorithm,sorting,Performance,Algorithm,Sorting,让A成为一个数组,其中包含要排序的总顺序。我们说A具有局部性d如果每个元素最多d索引远离排序数组中的最终索引。在局部感知合并算法中,不是完全合并两个子数组,而是只考虑中间代码< 2> 代码>元素(右子代码 d>代码>元素在左子数组中,左边的代码代码>元素在右子数组中),因为其他元素必须位于它们的最终位置。问题是如何证明局部感知mergesort的渐近时间性能是nlogd 还有其他排序算法的位置感知版本;本地感知mergesort的性能是我唯一不了解的性能。这很有意义。如果您仔细想想:合并排序是O

A
成为一个数组,其中包含要排序的总顺序。我们说
A
具有局部性
d
如果每个元素最多
d
索引远离排序数组中的最终索引。在局部感知合并算法中,不是完全合并两个子数组,而是只考虑中间代码< 2> <2>代码>元素(右子代码<代码> d>代码>元素在左子数组中,左边的代码代码>元素在右子数组中),因为其他元素必须位于它们的最终位置。问题是如何证明局部感知mergesort的渐近时间性能是
nlogd


还有其他排序算法的位置感知版本;本地感知mergesort的性能是我唯一不了解的性能。

这很有意义。如果您仔细想想:合并排序是O(nlog n),对于每个元素(n个元素),它在数组中的位置最多需要对数n次迭代(项可以“移动”的最大距离是n)。对于您的示例,它将仅为log d be,因为项目可以移动的距离限制为d。至少我是这么看的。

这不是更适合我吗?听起来像是家庭作业!问得好