I want to put two algorithm side by side to gain place in the document, but when I use \documentclass{llncs} instead of \documentclass{article}, the following code does not work (errors):
\documentclass{article}
\usepackage[margin=1in]{geometry}% http://ctan.org/pkg/geometry
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{algorithm}% http://ctan.org/pkg/algorithm
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{caption}% http://ctan.org/pkg/caption
\begin{document}
\lipsum[1]
\medskip
\noindent\begin{minipage}{.5\textwidth}
\captionof{algorithm}{Euclid’s algorithm}\label{algo1}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\captionof{algorithm}{Euclid’s algorithm}\label{algo2}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{minipage}
\medskip
On the left is Algorithm~\ref{algo1}. On the right is Algorithm~\ref{algo2}.
\lipsum[2]
\end{document}

\usepackage[margin=1in]{geometry}I can no more use\abovedisplayskip=-23pton some places in my document ! – user995434 Jul 01 '12 at 15:22subfig vs. subcaptionfor Axel's response. You might want to update the question (or better ask a new one) to address the problem with all your packages and tweaks included. – percusse Jul 01 '12 at 15:28\begin{subalgorithm}[t]{.5\textwidth}for both of them to align at the top. By the way, thecaptionmanual has some interesting remarks about thealgorithmandfloatpackages. So maybe you can make a bettersubalgorithmenvironment that I have given. – percusse Jul 01 '12 at 16:11\begin{subalgorithm}[t]{.5\textwidth}? it gives errors if I add it under on on top of\begin{algorithmic}[1].. – user995434 Jul 01 '12 at 16:34[t]part, sorry for the vaguesness. It's an additional option to thesubalgorithm. – percusse Jul 01 '12 at 16:35\usepackage[margin=1in]{geometry}will change the original margin of thellncsclass will be changed ! I'm not sure that this will be accepted by the conference for which I want to submit a paper :/ Is there any why to do the same by keeping the margin etc as specified by the llncs class ? – user995434 Jul 01 '12 at 17:20IEEEtranclass and usually these classes are using, understandably, outdated tricks. I usually don't mess with the page settings and try to reduce the size, shape or other properties of things. – percusse Jul 01 '12 at 17:23