List Ranking Moon Jung Chung - PowerPoint PPT Presentation

About This Presentation
Title:

List Ranking Moon Jung Chung

Description:

CSE838 Lecture notes copy right: Moon Jung Chung. Lecture -2. Pointer Jumping Review ... work O(nlogn) is not optimal. 9/8/09. CSE838 Lecture notes copy right: ... – PowerPoint PPT presentation

Number of Views:93
Avg rating:3.0/5.0
Slides: 13
Provided by: cse6
Learn more at: http://www.cse.msu.edu
Category:
Tags: chung | coloring | jung | list | moon | ranking

less

Transcript and Presenter's Notes

Title: List Ranking Moon Jung Chung


1
List RankingMoon Jung Chung
2
Pointer Jumping Review
How to compute a prefix on a linked list?
If NEXTi ! NILL then Xi lt- Xi
XNEXTi NEXTi lt- NEXTNEXTi
work O(nlogn) is not optimal
3
Pointer Jumping Review
How to compute a prefix on a linked list?
11
2
7
A node does not not jump if it is jumped
over. How to know to jump or not?
4
Random Pointer Jumping
pointer jump only if female-male
1
4
6
7
A-gtB-gtC is jumped to A-gtC. B is jumped over. No
jump crossing. i.e., A-gt B-gtC and B-gtC-gtD
simultaneously Once a node is jumped over, the
node becomes inactive. In reconstruction phase,
process are activated in reverse order.
5
Random list ranking algorithm
  • ranki 1, activei true, t1
  • in parallel while nexthead ! nil
  • if (activei and nexti! nil)
  • sexi random M,F
  • if sexi F and sexnexti M
  • timenexti t
  • activenexti false
  • ranki ranki
    ranknexti
  • nexti nextnexti
  • t
  • for kt down to 1
  • if (timei t and nexti ! nil)
  • ranki ranki ranknexti

6
complexity of easy random list ranking
  • Prob that a cell is not jumped over 3/4
  • Probability that a cell is not jumped over after
    k-iteration (3/4)k
  • Pi cell is not not jumped over after k rounds.
  • At least one cell is not jumped over after k
    rounds
  • P1 ? P2 ... ? Pn ? P1 P2 ... Pn 1/n(c-1)
    if we choose (3/4)k lt 1/nc
  • So, for (3/4)k lt 1/nc ltgt k clog 4/3n,
  • the error that it goes more than clog 4/3n rounds
    becomes 0.

7
Random ranking algorithm with O(n/logn) PEs,
O(logn) time
  • Shared memory model
  • each processor handles logn cell as a queue
  • processor only look at the top of the queue
  • jump over top i only if jprevi is top.
  • Then nexj nexti and remove top from the
    queue
  • Still has memory imbalance
  • Each PE can splice out
  • Slice_out(i)
  • prevnexti previ and nextptevi
    nexti
  • rankprevi rankprevi ranki
  • if nexti ! nil then prevnexti previ

8
Algorithm
  • Initially
  • ranki,k 1, sexi,k F
  • topi Qi.1 // Queue of PE is 1st element.
  • sexnil M
  • t1
  • while nexthead ! nil
  • if position of topi ? logn
  • sextopi randomM,F
  • if (sexprevtopi F and sextopi M
  • spliceout(topi)
  • position of topi points next in the queue
    of PE i
  • splicetimetopi t
  • t
  • Observation Prob. that a particular queue is not
    empty after 16logn rounds is lt 1/n.

9
Optimal Deterministic List Ranking Algorithm
  • How to pick 1/4 PEs with guarantee?
  • k-Ruling set
  • G(V,E) be the directed graph representation of a
    linked list L with vertices v1,...,vn.
  • A subset S of V is a ruling set if
  • 1. No two vertices in S are adjacent.
  • 2. For each vertex vi in V, there is a directed
    path from some vertex in S to vi with length at
    most k.
  • S head of each segment of linked list, k is the
    length from the ruler.
  • If we have a k-ruling set, every time we can
    select rulers (n/k elements) without conflict.
  • Observation k-coloring of a linked list can be
    converted into k-ruling set.
  • How to find k-ruling set?

10
Deterministic Coin Tossing and k-Coloring
11
List Ranking and Ruling Set
  • N/logN PEs
  • Each PE has logN data
  • Each PE has N/logN data
  • 1. Find a 6 ruling set
  • 2. Apply splice operation for ruling set
  • Each iteration
  • c(N/logN) top element be eliminated
  • C(N/logN) k N , k O(logN)
  • Complexity O(logN (logN)logN)

12
New Divide and Conquer Approach
  • List-Ranking (A, m)
  • 1. If m lt n/logn, apply list ranking with each PE
    one node
  • 2. Find Ruling Set
  • 3. Reduce list to A
  • 4. List-Ranking(A, m)
  • Depth of recursion O(loglogN)
  • Complexity logn loglogN
Write a Comment
User Comments (0)
About PowerShow.com