I would like to write pseudo code algorithm in Latex as in the attached picture.I have written code to make just like above algorithm but its not working for me. Is this code correct…
\IncMargin{1em}
\begin{algorithm}
\SetKwInOut{Part 1}{input}
\SetKwInOut{Part 2}{output}
\Part 1{}
\BlankLine
\emph{abcdefgh $D$ ijklmnop}\;
\emph{ abcdefgh $A$}\;
\For{$k\leftarrow 1$ \KwTo $M$}{
\For {each $m$ $ ∈ $ {1, 2, …, J}{
\emph{ abcdefgh $D$}\;
\emph{abcdef }\;
}
\Part 2{}
\emph{abcdefgh $A$ ijklmnop}\;
\emph{ abcdefgh $A$}\;
\For {each $m$ $ ∈ $ {1, 2, …, J}{
\emph{ abcdefgh $D$}\;
\emph{abcdef }\;
\emph{abcdef }\;
}
}
\For{$k\leftarrow 1$ \KwTo $M$}{
\emph{ abcdefghklmop}\;
\emph{ abcdefghklmop}\;
\emph{ abcdefghklmop}\;
}
\caption { Algorithm Sample}
\end{algorithm}
\DecMargin{1em}
Best Answer
The following is more in line with the regular syntax of
algorithm2e
: