More compact Algorithm template in Latex
All,
I am using the following Algorithm template:
\usepackage{algorithmicx}
\usepackage[ruled]{algorithm}
\usepackage{algpseudocode}
\vspace{-0.2cm}%
\alglanguage{pseudocode}
\begin{algorithm}[h]
\small
\caption{Delete item from Hash Table (with mCBF and aCBF)}
\label{Algorithm:delete_mCBF_aCBF}
\begin{algorithmic}[1]
\Procedure{$\mathbf{DeleteItem}$}{item $x$}
\LineComment{\emph{Quick check if $x$ is in mCBF}}
\For {$i = 1 \to k$}
\If {$mCBF.C_{f_i(x)\%N}$ == 0}
\State \textbf{return}
\EndIf
\EndFor
\LineComment{\emph{Look up $x$ in $aCBF_1\cdot\cdot\cdot aCBF_k$}}
\For {$i = 1 \to k$}
\If {\textbf{CBF\_query}($aCBF_i$, $x$) == \textbf{TRUE}}
\State $j \gets C_{f_i(x)\%N}$
\For {item $y \in B_j$}
\If {$y.key == x$}
\Comment \emph{found}
\State \emph{remove $y$ from hash table}
\EndIf
\EndFor
\EndIf
\EndFor
\EndProcedure
\Statex
\end{algorithmic}
\vspace{-0.4cm}%
\end{algorithm}
And I got this:
However, there are too many lines of end if and end for. Is there any more compact Algorithm template that does not contain these lines?
All,
I am using the following Algorithm template:
\usepackage{algorithmicx}
\usepackage[ruled]{algorithm}
\usepackage{algpseudocode}
\vspace{-0.2cm}%
\alglanguage{pseudocode}
\begin{algorithm}[h]
\small
\caption{Delete item from Hash Table (with mCBF and aCBF)}
\label{Algorithm:delete_mCBF_aCBF}
\begin{algorithmic}[1]
\Procedure{$\mathbf{DeleteItem}$}{item $x$}
\LineComment{\emph{Quick check if $x$ is in mCBF}}
\For {$i = 1 \to k$}
\If {$mCBF.C_{f_i(x)\%N}$ == 0}
\State \textbf{return}
\EndIf
\EndFor
\LineComment{\emph{Look up $x$ in $aCBF_1\cdot\cdot\cdot aCBF_k$}}
\For {$i = 1 \to k$}
\If {\textbf{CBF\_query}($aCBF_i$, $x$) == \textbf{TRUE}}
\State $j \gets C_{f_i(x)\%N}$
\For {item $y \in B_j$}
\If {$y.key == x$}
\Comment \emph{found}
\State \emph{remove $y$ from hash table}
\EndIf
\EndFor
\EndIf
\EndFor
\EndProcedure
\Statex
\end{algorithmic}
\vspace{-0.4cm}%
\end{algorithm}
And I got this:
However, there are too many lines of end if and end for. Is there any more compact Algorithm template that does not contain these lines?
No comments:
Post a Comment