Hi there!
I am just a beginner on writing pseudo-code in latex.
I need to write a pseudo-code (probably using algorithm and/or algorithmic packages) in latex, but could not get what I want.
I hereby attached the pseudo-code that I want to write.
Would you help me do that please?
Thank you and best regards!
Math & Science ⇒ Writing Pseudo-code in Latex
Writing Pseudo-code in Latex
- Attachments
-
- pseudo code.pdf
- (137.06 KiB) Downloaded 1190 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Writing Pseudo-code in Latex
Hi,
Stefan
what's the problem? What did you get?nenu28 wrote:I am just a beginner on writing pseudo-code in latex.
I need to write a pseudo-code (probably using algorithm and/or algorithmic packages) in latex, but could not get what I want.
Stefan
LaTeX.org admin
Re: Writing Pseudo-code in Latex
Hi Stefan_K and thanks for your message.
The problem is I want to write the pseudo-code (developed by C++ language) mentioned above.But I don't known how to type "{" or "}" on the lines 2, 8 and 10 of the algorithm.
Using algorithm and algorithmic packages, on the line 4 of the algorithm "for" is coming with "do".
So, is there a specific package to solve this problem ?
P.S: This Algorithm is developed bu C++ language /.
nenu
The problem is I want to write the pseudo-code (developed by C++ language) mentioned above.But I don't known how to type "{" or "}" on the lines 2, 8 and 10 of the algorithm.
Using algorithm and algorithmic packages, on the line 4 of the algorithm "for" is coming with "do".
So, is there a specific package to solve this problem ?
P.S: This Algorithm is developed bu C++ language /.
nenu
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Writing Pseudo-code in Latex
It would be easier if you would show sample code besides the description. Btw. { and } need often t be written \{ and \} because { and } are special characters in LaTeX.
Stefan
Stefan
LaTeX.org admin
Writing Pseudo-code in Latex
Hey Stephan,
I tried to manage to make the above algorithm by using both algorithm and algorithmic packages, but i got a problem with " line numbers " (See the code tex).
On the line 12, I don't want the number "12" appears. What should I do ? is there some technique to solve this ?
regards,
P.S: I just want to make this algorithm as shown the above attached pdf file
nenu
I tried to manage to make the above algorithm by using both algorithm and algorithmic packages, but i got a problem with " line numbers " (See the code tex).
Code: Select all
\listfiles
\documentclass[10pt]{report}
\usepackage {algorithm}
\usepackage {algorithmic}
\begin{document}
\begin{algorithm}
\caption{Apriori}
\vspace{2mm}
\textbf{Input:}\\
D: transaction database;\\
Min\_sup: the minimum support threshold\\
\textbf{Output:} frequent itemsets\\
\textbf{Description:}
\begin{algorithmic}[1]
\STATE $L_1$= find\_frequent\_1-itemsets(DB);
\STATE \textbf{for} (k=2; $L_{k-1}=\varphi; k++$) $\{$
\STATE $C_{k}$= Apriori\_gen($L_{k-1}$);
\STATE \textbf{for each} transaction $t\in DB$ $\{$ \quad //scan DB for
counts
\STATE $C_t=$ subset$(C_k,t)$;\quad //get the subsets of $t$ that
are candidates
\STATE \textbf{for each} candidate $c\in C_t$
\STATE $c.count++$;
\STATE $\}$
\STATE $L_k=\{c\in C_k | c.count\geq min\_sup\}$
\STATE $\}$
\STATE return $L=\bigcup_kL_k$;
\STATE Procedure Apriori gen($L_{k-1}$: frequent$(k-1)$-itemsets)
\end{algorithmic}
\end{algorithm}
\end{document}
regards,
P.S: I just want to make this algorithm as shown the above attached pdf file
nenu