Consider the following minimal example:
\documentclass[usenames,dvipsnames]{beamer}
\usepackage[linesnumbered,boxed,ruled,vlined,resetcount]{algorithm2e}
\begin{document}
\begin{frame}[fragile]
With caption:
\begin{algorithm}[H]
\KwIn{ $x, y$ }
\KwOut{$z$}
$z = x\cdot y + 1$
\Return $z$
\caption{$FindZ$}
\end{algorithm}
\vspace*{0.5cm}
Without caption:
\begin{algorithm}[H]
\TitleOfAlgo{$FindZ$}
\KwIn{ $x, y$ }
\KwOut{$z$}
$z = x\cdot y + 1$
\Return $z$
\end{algorithm}
\end{frame}
\end{document}
It generates the following slide with two algorithms:
In the first one, I used the command \caption and the nice thing is that the title appears between the two horizontal lines just before describing the input. But I don't like the number.
Following some answers I found here in tex.stackexchange, instead of \caption, I used \TitleOfAlgo in the second algorithm. Now I don't have the number in front of the word "Algorithm", but the title counts as a line of the algorithm (it is numbered as line 1). Also, it doesn't appear between the two lines (we see the two lines above it).
Is there a way of obtaining the same thing I obtain with Caption, but showing no number in front of "Algorithm" nor making it a numbered line?