Each separation and rest algorithm can be easily parallelized. Merging sorting and quick sorting are performed according to the same basic scheme, which can be performed in parallel:
procedure DivideAndConquer(X) if X is a base case then Process base case X return Divide X into [Y0 β¦ Yn[ for Y β [Y0 β¦ Yn[ in parallel do DivideAndConquer(Y) Merge [Y0 β¦ Yn[ back into X
Where they differ, it is that in quick sorting separation is difficult, and merging is trivial (without operation). In merging, sorting is the other way around: division is trivial and merging is difficult.
If you implement the above scheme, quicksort is actually easier to parallelize because you can just forget about the merge step. To sort a merge, you need to track completed parallel tasks. This delays load balancing.
On the other hand, if you follow the above diagram, you will have a problem: the very first section and the most recent merge will use only one processor, and all other processors will be idle. Thus, it makes sense to parallelize these operations as well. And here we see that the parallelization of the split step into quicksort is much more complicated than the parallelization of the merge step in the merge sort.
Konrad Rudolph
source share