Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Merge sort
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Merge sort with parallel recursion === The sequential merge sort procedure can be described in two phases, the divide phase and the merge phase. The first consists of many recursive calls that repeatedly perform the same division process until the subsequences are trivially sorted (containing one or no element). An intuitive approach is the parallelization of those recursive calls.<ref name="clrs">{{Harvtxt|Cormen|Leiserson|Rivest|Stein|2009|pp=797–805}}</ref> Following pseudocode describes the merge sort with parallel recursion using the [[Fork–join model|fork and join]] keywords: // ''Sort elements lo through hi (exclusive) of array A.'' '''algorithm''' mergesort(A, lo, hi) '''is''' '''if''' lo+1 < hi '''then''' // ''Two or more elements.'' mid := ⌊(lo + hi) / 2⌋ '''fork''' mergesort(A, lo, mid) mergesort(A, mid, hi) '''join''' merge(A, lo, mid, hi) This algorithm is the trivial modification of the sequential version and does not parallelize well. Therefore, its speedup is not very impressive. It has a [[Analysis of parallel algorithms#Overview|span]] of <math>\Theta(n)</math>, which is only an improvement of <math>\Theta(\log n)</math> compared to the sequential version (see [[Introduction to Algorithms]]). This is mainly due to the sequential merge method, as it is the bottleneck of the parallel executions.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Merge sort
(section)
Add topic