\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[boxed]{algorithm2e}

\begin{document}

\title{Using Algorithm2e}
\author{John Doe}
\maketitle

\section{Introduction}


\subsection{An alternating optimization algorithm}
bla 

\begin{algorithm}[h]
 \SetAlgoLined
 \KwData{$X$}
 \KwResult{Result}
 42\;
 \caption{An alg \label{alg:altOptRW}}
\end{algorithm}

\end{document}
