# Adjust design of algorithm when using the algorithmic package

I am using overleaf and I have inserted an algorithm into an template for a conference. Unfortunately, the algorithm is not displayed in the way I like: -the caption should be above the steps -there should be two lines before the caption "Algorithm" above - there should be a line at the end of the algorithm

Basically it should look similar to this examples (line numbers are not necessary): https://math-linux.com/latex-26/faq/latex-faq/article/how-to-write-algorithm-and-pseudocode-in-latex-usepackage-algorithm-usepackage-algorithmic

I tried to do this like they did, but it did not work out and I had to use the "algorithmic" \usepackage{algorithmic}

EDIT: Here is the Latex Code

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{gensymb}
\usepackage{xcolor}
\usepackage[options ]{algorithm2e}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}

\title{Title \\
{\footnotesize \textsuperscript{}}
}

\author{\IEEEauthorblockN{}
\IEEEauthorblockA{\textit{} \\
\textit{}\\
\\
}
\and
\IEEEauthorblockN{}
\IEEEauthorblockA{\textit{} \\
\textit{}\\
\\
}
\and
\IEEEauthorblockN{}
\IEEEauthorblockA{\textit{} \\
\textit{}\\
\\
}

}

\maketitle

\begin{abstract}
Abstract
\end{abstract}

\begin{IEEEkeywords}
component, formatting, style, styling, insert
\end{IEEEkeywords}

\section{Introduction}

\section{Optimization Problem}

\section{Methodology}
\label{section: Methodology}

\subsection{Method 1}

\begin{algorithm}[h]
\SetAlgoLined
\While{$t < Z$}{
\If{$T^{min} \leq T_t^{BS} \leq T^{max}$}{
Set $x_t = x_t^S$\;
}
\If{$T_t^{BS} > T^{max}$}{
Set $x_t = mDeg^{min}$\;
}
\If{$T_t^{BS} < T^{min}$}{
Set $x_t = 1$ \;
}
Set $t=t+1$\;
}
\caption{Algorithm 1}
\label{algo:BS}
\end{algorithm}

\subsection{Method 2}

\bibliography{bibtex}

\end{document}