I need some help with formatting my algorithm. What I have so far is this:
\documentclass[9pt]{sig-alternate}
\usepackage[linesnumbered,ruled]{algorithm2e}
\begin{document}
\begin{algorithm}
\SetAlgoNoLine
\KwData{The original list \textbf{R}, $ N \leq n $}
\KwResult{The re-ranked list \textbf{S}}
S = <>\;
\While{ |S| < N } {\do {$i^{*} = argmax_{i\in R\setminus S} f_{obj}(i,S,u)$ \;
S = S $ \circ i^{*}$\;
R = R $ \setminus {i^{*}}$ \;
\Return{S}\;
}
\
}
\caption{The greedy strategy.}
\label{Algorithm1}
\end{algorithm}
\end{document}
I am using algorithm2e
package with options linesnumbered
and ruled
.
The desired result looks something like this:
The ruled
option makes the caption appear at the top of the algorithm, but I need it to be at the bottom. Furthermore, in my document, the Return
statement appears before the end
statement. How can I exchange these?
This is how my document looks like so far:
Thanks.
\documentclass{...}
and ending with\end{document}
Please do not post code as an image but as real code in the question.