|
I even saw an article and talked about a parity sort:
One simple sorting algorithm is parity sorting. The idea is to repeat two scans in the array. The first scan selects all pairs of data items, a[j] and a[j+1], where j is an odd number (j=1, 3, 5,...). If the value order of their keywords is reversed, swap them. The second scan performs the same operation on all even data items (j=2, 4, 6, ...). Repeat the sorting twice until the array is all in order.
Parity sorting is actually very useful in a multi-processor environment. The processor can process each odd-numbered pair simultaneously, and then process the even-numbered pairs simultaneously. Because odd-numbered pairs are independent of each other, each pair can be compared and exchanged with different processors, which can be sorted quickly.
I don’t even know what's the use of this "repeated scan twice", isn't it just sorting the odd and even items separately? How can "repeating the sorting twice until the array is all ordered"?
Even Baidu did not find any related articles
Could any master give advice, thank you! |
|