1 \documentclass[10pt
]{amsart
}
4 \usepackage{algpseudocode
}
8 \caption{Cocktail shaker sort
}
12 \State $swapped
\gets \texttt{true
}$
14 \State $swapped
\gets \texttt{false
}$
15 \ForAll{$i
\in \
{ 0,
1,
\dotsc, |A| -
2\
}$
}
17 \State \Call{swap
}{A, i, i+
1}
18 \State $swapped
\gets \texttt{true
}$
24 \State $swapped
\gets \texttt{false
}$
25 \ForAll{$i
\in \
{ |A| -
2,
\dotsc,
1,
0 \
}$
}
27 \State \Call{swap
}{A, i, i+
1}
28 \State $swapped
\gets \texttt{true
}$