HyperQuicksort

HyperQuicksort - Lecture 12: Parallel quicksort algorithms...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 12: Parallel quicksort algorithms Lecture 12: Parallel quicksort algorithms – p. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Overview Sequential quicksort algorithm Three parallel quicksort algorithms Chapter 14 in Michael J. Quinn , Parallel Programming in C with MPI and OpenMP Lecture 12: Parallel quicksort algorithms – p. 2
Background image of page 2
Recap of quicksort Given a list of numbers, we want to sort the numbers in an increasing order The same as finding a suitable permutation Sequential quicksort algorithm: a recursive procedure Select one of the numbers as pivot Divide the list into two sublists: a “low list” containing numbers smaller than the pivot, and a “high list” containing numbers larger than the pivot The low list and high list recursively repeat the procedure to sort themselves The final sorted result is the concatenation of the sorted low list, the pivot, and the sorted high list Lecture 12: Parallel quicksort algorithms – p. 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example of quicksort Given a list of numbers: { 79 , 17 , 14 , 65 , 89 , 4 , 95 , 22 , 63 , 11 } The first number, 79, is chosen as pivot Low list contains { 17 , 14 , 65 , 4 , 22 , 63 , 11 } High list contains { 89 , 95 } For sublist { 17 , 14 , 65 , 4 , 22 , 63 , 11 } , choose 17 as pivot Low list contains { 14 , 4 , 11 } High list contains { 64 , 22 , 63 } . . . { 4 , 11 , 14 , 17 , 22 , 63 , 65 } is the sorted result of sublist { 17 , 14 , 65 , 4 , 22 , 63 , 11 } For sublist { 89 , 95 } choose 89 as pivot Low list is empty (no need for further recursions) High list contains { 95 } (no need for further recursions) { 89 , 95 } is the sorted result of sublist { 89 , 95 } Final sorted result: { 4 , 11 , 14 , 17 , 22 , 63 , 65 , 79 , 89 , 95 } Lecture 12: Parallel quicksort algorithms – p. 4
Background image of page 4
Illustration of quicksort Figure 14.1 from Parallel Programming in C with MPI and OpenMP Lecture 12: Parallel quicksort algorithms – p. 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Two observartions Quicksort is generally recognized as the fastest sorting algorithm based on comparison of keys, in the average case Quicksort has some natural concurrency The low list and high list can sort themselves concurrently Lecture 12: Parallel quicksort algorithms – p. 6
Background image of page 6
Parallel quicksort We consider the case of distributed memory Each process holds a segment of the unsorted list The unsorted list is evenly distributed among the processes Desired result of a parallel quicksort algorithm: The list segment stored on each process is sorted The last element on process i ’s list is smaller than the first element on process i + 1 ’s list Lecture 12: Parallel quicksort algorithms – p. 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 25

HyperQuicksort - Lecture 12: Parallel quicksort algorithms...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online