Rank Computation

$\mbox{\sc Rank}(L, p)$ is the rank position of person p in ROL L.


\begin{algorithm}
{Rank}{L,p}
 \begin{FOR}
{\EACH j \in \{1,n\}}
 \begin{IF}
{L[j] = p}
 \RETURN j
 \end{IF} \end{FOR} \\  \RETURN {\tt Bug!}\end{algorithm}

What's the total algorithm running time?

Not hard to do better than this (HW).


next up previous
Next: THE MATCHING ALGORITHM Up: THE STABLE MARRIAGE PROBLEM Previous: Stability Checking