I need to place an algorithm inside my text. However, it keeps being displayed incorrectly. Could you take a look at the LaTeX code and help me find where I am going wrong?
This is the code I'm currently using:
\documentclass[12pt,oneside,a4paper,brazil]{report}
\usepackage{algorithm}
\usepackage{float}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[noend]{algpseudocode}
\newcommand\BB{BB}
\begin{document}
\begin{algorithm}
\caption{The \BB algorithm}
\begin{algorithmic}
\State \BB(G, Q, K)
\State $\text{C} \gets \text{Q}$
\If {$\text{K} \neq \emptyset$ }
\State $\text{v} \gets \text{a vertex in K}$
\State ${C_1 \gets BB(G, Q \cup \{v\}, U \cap \Gamma_G(v))$
\If {$|C_1| > |C|$}
\State $C \gets C_1$
\EndIf
\State $C_2 \gets BB(G, Q, K - v)$
\If {$|C_2| > |C|$}
\State $C \gets C_2$
\EndIf
\EndIf
\Return $C$
\end{algorithmic}
\end{algorithm}
\end{document}
Any help will be much appreciated.
! Missing } inserted. <inserted text> }
after an error it is not worth even looking at the generated pdf, your question should have asked about the error not shown the output. Also If I run it, I get a line break before If and it says If not Se. I will add a document to your question but please edit it to show the problem.