哪种排序方法是并行处理最合适? [英] Which sorting method is most suitable for parallel processing?
问题描述
我现在在看我的老同学作业,并希望找到一个问题的解决方案。
I am now looking at my old school assignment and want to find the solution of a question.
哪种排序方法是并行处理最合适?
Which sorting method is most suitable for parallel processing?
- 冒泡排序
- 快速排序
- 在合并排序
- 选择排序
我想快速排序(或归并排序?)就是答案。
I guess quick sort (or merge sort?) is the answer.
我是正确的?
推荐答案
像归并排序,快速排序,也可以很容易地由于其分而治之的自然并行。个人就地分区操作难以并行,但一旦分割,列表的不同部分可以并行排序
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
这篇关于哪种排序方法是并行处理最合适?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!