\end{algorithmic}\r
\r
\begin{algorithmic}[1]\r
-\Function{PutSlot}{$s',sv',max'$}\r
+\Function{PutSlot}{$s_p,sv_p,max'$}\r
\If{$(max' \neq \emptyset)$}\Comment{Resize}\r
\State $max \gets max'$\r
\EndIf\r
-\If{$(s' = s_n + d)$}\r
+\State $s_n \gets \{\langle s,sv \rangle \in SL \mid \r
+ \forall \langle s_i,sv_i \rangle \in SL, s \geq s_i\}$\Comment{Last s}\r
+\If{$(s_p = s_n + 1)$}\r
\If{$n = max$}\r
- \State $SL \gets SL - \{\langle s_n,sv_n \rangle\}$\r
+ \State $SL \gets SL - \{\langle s,sv \rangle \in SL \mid \r
+ \forall \langle s_i,sv_i \rangle \in SL, s \leq s_i\}$\Comment{First s}\r
\Else \Comment{$n < max$}\r
\State $n \gets n + 1$\r
\EndIf\r
- \State $SL \gets SL \cup \{\langle s',sv' \rangle\}$\r
+ \State $SL \gets SL \cup \{\langle s_p,sv_p \rangle\}$\r
\State \Return{$true$}\r
\Else\r
- \State \Return{$(false,\{\langle i,sv_i \rangle \in SL \mid \r
- s' \leq i \leq s_n\})$}\r
+ \State \Return{$(false,\{\langle s,sv \rangle \in SL \mid \r
+ s \geq s_p\})$}\r
\EndIf\r
\EndFunction\r
\end{algorithmic}\r