Recall the operation of a bubble sort algorithm. For
elements, a first
phase iterates through the elements, comparing and exchanging neighbors, with
operations. After the first phase the largest element will have "bubbled" to the end of the array.
Since the largest element appears at the end of the array after the first
phase, the second phase need only iterate
times. The bubble sort however
takes
sequential steps.
![\includegraphics[width=\linewidth]{sorting-bubble.eps}](img324.gif)
The second phase of the bubble sort algorithm can begin after the second iteration of the first phase.
The third phase can begin after the fourth iteration, the fourth phase after the sixth iteration and so on.
In effect each parallel computational step can pair off either the odd or even neighboring pairs.
![\includegraphics[width=\linewidth]{sorting-transposition.eps}](img325.gif)
|
|