next up previous
Next: Up: Previous:

List Ranking

For each object in the list, compute distance to the end of the list.

\begin{displaymath}d(i) \;=\; \left\{ \begin{array}{ll} 0 & {\rm if} \;next(i) \...
...+ 1 & {\rm if} \;next(i) \;\neq \;{\rm NIL} \end{array} \right.\end{displaymath}

Serial:
\(\Theta(n)\)
Parallel:
O(lg n)
Idea:

   repeat
      pointer jump
      add number of objects jumped to current distance
   until all next(i) = NIL

Speedup:
S = T (best serial algorithm) / T (parallel algorithm)
\(S \;=\; \frac{O(n)}{O(\lg n)}\)


next up previous
Next: Up: Previous: