\begin{algorithm} \caption{GnomeSort} \begin{algorithmic} \PROCEDURE{GnomeSort}{$A, n$} \STATE $i \gets 0$ \WHILE{$i < n$} \IF{$i = 0$ \OR $A[i] \geq A[i-1]$} \STATE $i \gets i + 1$ \ELSE \STATE \CALL{swap}{$A[i]$, $A[i-1]$} \STATE $i \gets i - 1$ \ENDIF \ENDWHILE \ENDPROCEDURE \end{algorithmic} \end{algorithm}