program max3; // find the maximum number in o(logN) time (EREW) const n = 8; sharedvar values : array[1..2*n] of word; procedure init; var i : word; begin P := n; for i := 1 to n do // initialize the values // values[i] := i; values[i+n] := -10; writeln(values[i]); end; // for end init; procedure finish; begin writeln(values[1]); // write the result // end finish; var i,j,big,temp,incr : word; begin // main // the algorithm to find the maximum in log(n) time par i := 1 to n sync do big := values[i]; incr := 1; for j := 1 to log(n) do temp := values[i+incr]; if (big < temp) then big := temp; end; // if incr := 2*incr; values[i] := big; end // for end; // par @CLOCK end max3.