\begin{algorithm} \caption{BubbleSort} \begin{algorithmic} \PROCEDURE{BubbleSort}{$A, n$} \FOR{$i \gets 1$ \TO $n - 1$} \FOR{$j \gets 0$ \TO $n - i$} \IF{$A[j] > A[j+1]$} \STATE \CALL{swap}{$A[j]$, $A[j+1]$} \ENDIF \ENDFOR \ENDFOR \ENDPROCEDURE \end{algorithmic} \end{algorithm}