views:

275

answers:

3

I am now looking at my old school assignment and want to find the solution of a question. Here is the question:

Which sorting method is most suitable for parallel processing?

  1. Bubble sort
  2. Quick sort
  3. Merge sort
  4. Selection sort

I guess quick sort (or merge sort?) is the answer.

Am I correct?

+5  A: 

i think merge sort

you can divide the dataset and make parallel operations on them..

ufukgun
+1 even though your nick scares me.
Will
my name is Ufuk Gün, but in English it sounds funny :)
ufukgun
Mergesort requires synchronization between threads to merge the sorting results. Quicksort does not need any thread synchronization.
Ben S
+8  A: 

Like merge sort, quicksort can also be easily parallelized due to its divide-and-conquer nature. Individual in-place partition operations are difficult to parallelize, but once divided, different sections of the list can be sorted in parallel.

One advantage of parallel quicksort over other parallel sort algorithms is that no synchronization is required. A new thread is started as soon as a sublist is available for it to work on and it does not communicate with other threads. When all threads complete, the sort is done.

http://en.wikipedia.org/wiki/Quicksort

Irwin M. Fletcher
+1: Quicksort does not require synchronization once split. Mergesort requires synchronization to merge.
Ben S
+4  A: 

It depends completely on the method of parallelization. For multithreaded general computing, a merge sort provides pretty reliable load balancing and memory localization properties. For a large sorting network in hardware, a form of Batcher, Bitonic, or Shell sort is actually best if you want good O(log² n) performance.

280Z28