Content deleted Content added
m →Parallel merge: task, replaced: Dr. Dobbs Journal → Dr. Dobb's Journal |
Jimbauwens (talk | contribs) Clarify algorithm description. Should need some extra work but this already helps a lot. |
||
Line 113:
merge(A[r+1...j], B[s...ℓ], C[t+1...q])
The algorithm operates by splitting either {{mvar|A}} or {{mvar|B}}, whichever is larger, into (nearly) equal halves. It then splits the other array into a part
The [[Analysis of parallel algorithms#Overview|work]] performed by the algorithm for two arrays holding a total of {{mvar|n}} elements, i.e., the running time of a serial version of it, is {{math|''O''(''n'')}}. This is optimal since {{mvar|n}} elements need to be copied into {{mvar|C}}. Its critical path length, however, is {{math|Θ(log<sup>2</sup> ''n'')}}, meaning that it takes that much time on an ideal machine with an unbounded number of processors.{{r|clrs}}{{rp|801–802}}
|