caption and label should start their own lines
[llf.git] / tests / 21.output.tex
blob7e1d98e8418520d1dd69365b20fdff5880b50f9a
1 \documentclass[10pt]{amsart}
3 \usepackage{algorithm}
4 \usepackage{algpseudocode}
6 \begin{document}
7 \begin{algorithm}
8 \caption{Cocktail shaker sort}
9 \label{alg:cocktail}
10 \begin{algorithmic}
11 \Function{CSS}{$A$}
12 \State $swapped \gets \texttt{true}$
13 \While{$swapped$}
14 \State $swapped \gets \texttt{false}$
15 \ForAll{$i \in \{ 0, 1, \dotsc, |A| - 2\}$}
16 \If{$A_i > A_{i+1}$}
17 \State \Call{swap}{A, i, i+1}
18 \State $swapped \gets \texttt{true}$
19 \EndIf
20 \EndFor
21 \If{$\lnot swapped$}
22 \State \Call{break}{}
23 \EndIf
24 \State $swapped \gets \texttt{false}$
25 \ForAll{$i \in \{ |A| - 2, \dotsc, 1, 0 \}$}
26 \If{$A_i > A_{i+1}$}
27 \State \Call{swap}{A, i, i+1}
28 \State $swapped \gets \texttt{true}$
29 \EndIf
30 \EndFor
31 \EndWhile
32 \EndFunction
33 \end{algorithmic}
34 \end{algorithm}
35 \end{document}