How can I write 'begin' and 'end' statement at the top and bottom the following code like this?A sample pseuodcode with begin and end statement
Besides using algorithm and algopseudocode package I can write Require and Ensure statement. Those are not properly aligned. Is there any way to align like the attached pic?
% book example for classicthesis.sty
\documentclass[
% Replace twoside with oneside if you are printing your thesis on a single side
% of the paper, or for viewing on screen.
%oneside,
twoside,
11pt, a4paper,
footinclude=true,
headinclude=true,
cleardoublepage=empty
]{scrbook}
\usepackage{lipsum}
\usepackage[linedheaders,parts,pdfspacing]{classicthesis}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{acronym}
\usepackage{algpseudocode}
\usepackage{algorithm}
\begin{document}
\chapter{A Chapter}
\begin{algorithm}
\caption{Apriori algorithm}
\begin{algorithmic}[1]
\State $L_{1} \leftarrow Frequent 1-itemset $
\State $k \leftarrow 2$
\While{$L_{k-1} \neq \phi$}
\State $Temp \leftarrow candidateItemSet (L_{k-1})$
\State $C_{k} \leftarrow frequencyOfItemSet (Temp)$
\State $L_{k} \leftarrow compareItemSetWithMinimumSupport (C_{k}, minsup) $
\State $k \leftarrow k + 1$
\EndWhile\\
\Return L
\end{algorithmic}
\end{algorithm}
\end{document}
\documentclass{...}
and ending with\end{document}
so that users willing to help will have a starting point without the need of additional setup.algorithmicx
section 4.2. Something like\algblock[name]{begin}{end}
with\begin
and\end
statements as needed.\begin
and\end
are already defined... You can not use them.