Parallel Algorithms: Difference between revisions

Line 132: Line 132:
for 1 <= i <= p pardo
for 1 <= i <= p pardo
   k = ceil(b(i)/(n/p)) * (n/p)
   k = ceil(b(i)/(n/p)) * (n/p)
   merge slice A[(n/p)(i-1)+1:min(a(i), (n/p)i+1)] and B[b(i):min(b(i+1), k)]
   merge slice A[(n/p)(i-1)+1:min(a(i), end_a] and B[b(i):end_b]
</pre>
</pre>
;Notes
* We do not need to compute A_end or B_end. Just continue merging until we hit some index where (i % x)=0 in A or B.


===Techinque: Divide and Conquer===
===Techinque: Divide and Conquer===