PRAM Sorting and Maximal Independent Set




CS255

Chris Pollett

Feb 27, 2019

Outline

Introduction

Parallel Complexity Classs

BoxSort - Review

  1. Pick `n^(1/2)` elements at random from our array of `n` elements to sort. Then using `n` processors sort them in `O(log n)` steps.
    • Each random element require `O(log n)` coin flips to generate (can do in parallel).
    • We can imagine having an array `R` giving the indices of the randomly selected elements.
    • After sorting, the array `R` has its indices rearranged so they give the selected elements in ascending order.
    • To do the sorting we imagine for each `i` of the `sqrt(n)` many element of `R`, using `sqrt(n)-1` processors to compare it with the other `sqrt(n)-1` elements, then using `O(log n)` time to sum the values of these comparisons to determine the number of elements smaller than `i`.
  2. Then using these sorted elements insert the remaining elements among them in `O(log n)` steps:
    • Notice, using binary search, a processor `i` can determine between which two splitters pointed to by `R`, `A_i` should go in `O(log n)` time.
    • So it can output a bit `b_i` saying whether location `i` is less than its splitter's location as pointed to by the index in `R` or not.
    • We can then compute sums `S_i` of these bits in parallel as with the QuickSort case and move in the same fashion.
  3. Treat the remaining elements that are inserted between splitter as subproblems, recur on each subproblem whose size exceed `log n`, otherwise, use LogSort:
    • Compare each element in parallel with its neighbor first to its left, swap if necessary; then to its right, swap if necessary, do this O(log n) times.

In-Class Exercise

Intuition on Splitting

Analysis of Splitting

The End of Sorting

Maximal Independent Set

Example of Maximal Independent Sets

Analysis of Greedy MIS