display algorithms side by side

This is what i tried, but i can get the algorithms to display side by side.

\begin{minipage}{\textwidth}
\centering
\begin{minipage}{0.48\textwidth}
\centering
%\begin{algorithm}
\captionof{algorithm}{alg1}
\label{alg:case3}
\begin{algorithmic}
\REQUIRE $\F$, $O''$,
\ENSURE $I''$
\STATE $P_O \leftarrow$  $O''$
\STATE I $\leftarrow$ \{$I_1,I_2,..., I_n$\};

\end{algorithmic}
\end{minipage}

\begin{minipage}[c]{0.48\textwidth}
\centering
%\begin{algorithm}
\captionof{algorithm}{alg2}
\label{alg:case2_2}
\begin{algorithmic}
\REQUIRE $T$,  $O''$, $I$,
\ENSURE $I''$
\STATE $P_O \leftarrow$  $O''$
\STATE $W'_O \leftarrow \O$

\end{algorithmic}
\end{minipage}
\captionof{figure}{Both alg}
\label{xxxxx}
\end{minipage}


Where could i be going wrong?

• Does removing the empty lines at the end of the environments help? – Seamus Aug 12 '11 at 11:23
• Ah: remove the first \centering might fix it – Seamus Aug 12 '11 at 11:23
• fixed, thanks. How do i add a frame around each algorithms? – user739807 Aug 12 '11 at 11:32

The \centering of the "outer" minipage causes the two "inner" minipages to be centered. Without this, LaTeX will put the first minipage flushed left, and then see if there's room for the next one: there is, so it will be put next to it, as desired. You might want to add a \hfill between the two inner minipages so that the second one is flushed right and thus the page will be more balanced.
If you enclose the minipage in an \fbox this will put a frame around it:
\fbox{\begin{minipage...

But depending on what package you're using to set your algorithms, it might include its own resources for adding frames. The framed and mdframed packages provide further options for customising frames.