Finding The Maximum On PRAM
Finding the maximum of n values in V is best done with max<< V, but it can be computed using Valiant’s algorithm
- In round i use all P (= n) processors to compare for all pairs of 2¦n numbers, finding the Ri max
-- Round i
x[j] := 1 -- initialize
if V[j] <= V[k] then x[j]:=0 -- each k < j
if x[j] = 1 then Ri := V[j] -- find winner
- Repeat same process on the maxes found
- The algorithm finds the global max in time O(loglog n)