Created
June 29, 2012 06:49
-
-
Save ashwin/3016347 to your computer and use it in GitHub Desktop.
Inserting algorithm in LaTeX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Add the packages | |
\usepackage{algorithm} | |
\usepackage{algpseudocode} | |
% Insert the algorithm | |
\begin{algorithm} | |
\caption{Compute sum of integers in array} | |
\label{array-sum} | |
\begin{algorithmic}[1] | |
\Procedure{ArraySum}{$A$} | |
\State $sum = 0$ | |
\For {each integer $i$ in $A$} | |
\State $sum = sum + i$ | |
\EndFor | |
\State Return $sum$ | |
\EndProcedure | |
\end{algorithmic} | |
\end{algorithm} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment