Algorithm example 1:
Code:
Package:
Algorithm example 2:
Code:
% Algorithm example 1:
Example 1:\cite{algo} \\
\begin{algorithm}[H]
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
% Algorithm example 2:
Example 2:\cite{algo} \\
\begin{algorithmic}
\STATE $i\gets 10$
\IF {$i\geq 5$}
\STATE $i\gets i-1$
\ELSE
\IF {$i\leq 3$}
\STATE $i\gets i+2$
\ENDIF
\ENDIF
\end{algorithmic}
Reference:
留言列表