# Algorithm writing in latex

How can I write this algorithm in left align latex of 2 column?

I have tried this but its not working

    \textit{repeat till convergence}
$$\small \label{eq_04} { W_{i+1} = W_i - \alpha \frac{\partial}{\partial W_i}f(W_i) }$$


The following solution works by setting up a dedicated environment called myalgo. The "outer" equation environment assures that there's some vertical separation between the algo material and the text above and below it, and it also provides an equation number. The "inner" minipage environment, whose width is set to 0.9\columnwidth, assures that each line starts flush-left within the minipage. Instances of myalg may be cross-referenced via the usual \label-\ref mechanism.

\documentclass[twocolumn]{article}
\newenvironment{myalgo}{%
$$\begin{minipage}{0.9\columnwidth}\obeylines}{% \end{minipage}$$}

\begin{document}
\noindent
Generally, for a simple supervised learning the \dots
\begin{myalgo} \label{alg:1}
$\displaystyle W_{i+1} = W_i - \alpha \frac{\partial}{\partial W_i} f(W_i)$
Here $W_i$ are network parameters of each \dots