\usepackage{algorithm} %format of the algorithm
\usepackage{algorithmic} %format of the algorithm
\u...
\usepackage{algorithm} %format of the algorithm
\usepackage{algorithmic} %format of the algorithm
\usepackage{multirow} %multirow for format of table
\usepackage{amsmath}
\usepackage{xcolor}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{algorithm}
\caption{Sample algorithm}
\label{alg1}
\begin{algorithmic}[1]
\REQUIRE Text:Today is a good day. Variables:$u,v,w$. $G=(V,E)$
\ENSURE Something...
% if-then-else
\IF{some condition is true}
\STATE do some processing
\ELSIF{some other condition is true}
\STATE do some different processing
\ELSE
\STATE do the default actions
\ENDIF
\REPEAT
\STATE carry out some processing
\UNTIL{some condition is met}
% infinite loop
\LOOP
\STATE this processing will be repeated forever
\ENDLOOP
\end{algorithmic}
\end{algorithm}
一周热门 更多>