Throughout the document, I use \renewcommand{\baselinestretch}{1.5} for the entire document. Now I want to set only the algorithm environment in \usepackage{algorithm2e} to the normal spacing, what should I do?
\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
%\renewcommand{\baselinestretch}{1.5}
\RestyleAlgo{ruled}
I want my main text to be baselinestretch 1.5. by using renewcommand{baselinestretch}{1.5}
\begin{algorithm}
\caption{Triple Rapid}\label{alg:three}
%\KwData{Write here the required data}
%\KwResult{Write here the expected result}
Initialization: A list of distinct integers $x = \{x_1,x_2,\dots,x_n\}$\;
\eIf{$n\leq 1$}{
Return $x$
}{
Set Pivot $p = x$\;
Extract list of elements $x'$ less than $p$\;
Extract list of elements $x''$ greater than $p$\;
Return (\text{TripleRapid}($x'$), $p$, \text{TripleRapid}($x''$))\;
}
\end{algorithm}
\end{document}
If I use \renewcommand{\baselinestretch}{1.5}
, the algorithm will gives something like this
However, I want something that looks like this