\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
...
\begin{algorithm}
\DontPrintSemicolon
\KwIn{A set $Q={q_1, \ldots, q_n}$ of integers}
\KwOut{The greatest integer}
$m \gets Q[0]$;
\While{$q \in Q$} {
\If{$m < q$} {
$m \gets q$;
}
\Else{
Continue;
}
}
\Return{$m$};
\caption{{\sc Max} finds the greater number}
\end{algorithm}