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