There is a known problem in the Algorithm package. You can not
use \COMMENT as the first statement of any closed structure, such as
\IF..\ENDIF, \FOR..\ENDFOR, \FORALL..\ENDFORALL, \WHILE..\ENDWHILE,
and \begin{algorithmic}..\end{algorithmic}. An error "LaTeX Error:
Something's wrong--perhaps a missing \item" will be reported (It
does not make much sense). There are two workaounds:
Use \STATE \COMMENT{<text>}.
Use the optional arguments in those closed structures. For
example, \WHILE[<comment-text>]{<condition>}