能多快“发现最大的一个阵列”可能得到什么呢? [英] How fast can 'finding the max in an array' possibly get?

查看:130
本文介绍了能多快“发现最大的一个阵列”可能得到什么呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题来自被在此的其他问题引发了讨论: <一href="http://stackoverflow.com/questions/8604503/parallelize-already-linear-time-algorithm/8604616#8604616">Parallelize已经线性时间的算法。它的没有的功课。

This question comes from a discussion that was touched off on this other question: Parallelize already linear-time algorithm. It is not homework.

您给出的 N 号码,一机阵列与 P 处理器和共享 CREW 内存(并行读取,独占写内存)。

You are given an array of N numbers, and a machine with P processors and a shared CREW memory (Concurrent Read, Exclusive Write memory).

什么是的紧密上限上的最快的算法找到的最大的数组中的号码吗? [显然,也:什么是算法本身]

What is the tightest upper bound on the fastest algorithm to find the largest number in the array? [Obviously, also: What is the algorithm itself?]

我不是指执行工作的总量[从而可以的永远的小于O(N)]

I am not referring to the total amount of work performed [which can never be less than O(N)].

推荐答案

我认为这是 O(N / P')+ O(LOG2(P')),其中, P'= {最小的N,P} P'处理器搜索最高 的N / P'每一个元素,其次是 LOG2 两两合并到并行完成。第一个 P'/ 2 由偶数处理器,明年合并完成'P'/ 4 - 通过处理器的位置被8整除16,那么,等上。

I think it's O(N/P') + O(Log2(P')), where P'=min{N,P}. P' processors search for max of N/P' elements each, followed by Log2 pairwise merges done in parallel. The first P'/2 merges are done by even-numbered processors, next 'P'/4' - by processors at locations divisible by 8, then by 16, and so on.

修改 P'引入覆盖的情况下,当你有比你需要搜索的元素显著更多的处理器节点。

Edit P' is introduced to cover the case when you have significantly more processor nodes than the elements that you need to search.

这篇关于能多快“发现最大的一个阵列”可能得到什么呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆