KTUGFaq
KTUG FAQ
FrontPage › Algorithm
Algorithms Àº Rogerio Brito °¡ ¸¸µç ¾Ë°í¸®Áò Ç¥Çö ÆÐÅ°ÁöÀÌ´Ù. CS ºÐ¾ß¿¡¼´Â °¢Á¾ ¾Ë°í¸®ÁòÀ» Ç¥ÇöÇØ¾ß ÇÏ´Â °æ¿ì°¡ ¸¹Àºµ¥ ÀÌ°æ¿ì Æí¸®ÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ´Ù.
[ÆíÁý]
algorithmic ȯ°æ ¶
algorithmic ȯ°æÀº item À» ±â¹ÝÀ¸·Î Çϱ⠶§¹®¿¡ Á¦ÀÏ Ã³À½¿¡ ¸í·É¾î°¡ ³ª¿Í¾ß ÇÑ´Ù. [1] Àº ¹øÈ£¸¦ Çϳª¾¿ ºÙÀ̶ó´Â Àǹ̰¡ µÈ´Ù.
\begin{algorithmic}[1] \Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b} \State $r\gets a\bmod b$ \While{$r\not=0$}\Comment{We have the answer if r is 0} \State $a\gets b$ \State $b\gets r$ \State $r\gets a\bmod b$ \EndWhile\label{euclidendwhile} \State \textbf{return} $b$\Comment{The g.c.d. is b} \EndProcedure \end{algorithmic}
[ÆíÁý]
algorithm ȯ°æ ¶
À̸¦ float ÇÏ°Ô ¸¸µé±â À§Çؼ´Â algorithm À» ÀÌ¿ëÇÏ¸é µÈ´Ù.
\begin{algorithm} \caption{Euclid¡¯s algorithm}\label{euclid} \begin{algorithmic}[1] ... \end{algorithmic} \end{algorithm}
\listofalgorithms µµ Á¦°øµÈ´Ù.
[ÆíÁý]
memoir ¿ÍÀÇ Ãæµ¹ÇØ°á ¶
float ¶§¹®¿¡ memoir ¸¦ »ç¿ëÇÏ¸é ¹®Á¦°¡ »ý±ä´Ù. ÀÌ´Â ´ÙÀ½°ú °°ÀÌ ÇØ°áÇÑ´Ù. Âü°í 18108
\documentclass{memoir} \let\MEMOIRnewfloat\newfloat \let\newfloat\relax \usepackage{algorithm} \usepackage{algpseudocode} \let\newfloat\MEMOIRnewfloat
[ÆíÁý]
comment ¸ð½À ¹Ù²Ù±â ¶
°¡²û C++ ½ºÅ¸ÀÏ·Î Ä¿¸àÆ®¸¦ ¸¸µé°í ½ÍÀ» ¶§°¡ ÀÖ´Ù. ÀÌ°æ¿ì´Â ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.
\renewcommand{\algorithmiccomment}[1]{\hfill// #1}
[ÆíÁý]
¿¹Á¦ ¹× °á°ú ¶
°£´ÜÇÑ À¯Å¬¸®µå ¾Ë°í¸®ÁòÀÇ ¿¹ÀÌ´Ù.
\documentclass{memoir} \let\MEMOIRnewfloat\newfloat \let\newfloat\relax \usepackage{algorithm} \usepackage{algpseudocode} \let\newfloat\MEMOIRnewfloat \renewcommand{\algorithmiccomment}[1]{// #1} \begin{document} \listofalgorithms \begin{algorithm} \caption{Euclid¡¯s algorithm}\label{euclid} \begin{algorithmic}[1] \Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b} \State $r\gets a\bmod b$ \While{$r\not=0$}\Comment{We have the answer if r is 0} \State $a\gets b$ \State $b\gets r$ \State $r\gets a\bmod b$ \EndWhile\label{euclidendwhile} \State \textbf{return} $b$\Comment{The g.c.d. is b} \EndProcedure \end{algorithmic} \end{algorithm} \end{document}
°á°ú´Â ´ÙÀ½°ú °°´Ù.
[ÆíÁý]
algorithmicx ÆÐÅ°Áö ¶
algorithmic ÆÐÅ°Áö¸¦ ´õ È®ÀåÇÑ °ÍÀÌ algorithmicx ÆÐÅ°ÁöÀÌ´Ù. \usepackage{algpseudocode} ¸¦ »ç¿ëÇÔÀ¸·Î¼ ÀÚµ¿ÀûÀ¸·Î ÀÌ¿ëÇÏ°Ô µÈ´Ù. ÆÐÅ°Áö ¼³¸íÀº ´ÙÀ½°ú °°´Ù.
algorithmicx.pdf (191.55 KB)
[ÆíÁý]
Introduction to Algorithms, Second Edition. ¶
¾Ë°í¸®Áò¿¡ °üÇؼ ¹ÙÀÌºí °ÝÀÎ ÀÌ Ã¥ÀÇ LaTeX clrscode.sty ´Â ´ÙÀ½ÀÇ À§Ä¡¿¡¼ ±¸ÇÒ ¼ö ÀÖ´Ù.
http://www.cs.dartmouth.edu/~thc/clrscode/
[ÆíÁý]
Âü°í ¶
´Ù¸¥ ÇÁ·Î±×·¡¹Ö °ü·Ã ÆäÀÌÁö´Â SourceCodeListingÀ» º¸¸é µÈ´Ù.
ÆÐÅ°Áö ¼³¸íÆÄÀÏÀº ´ÙÀ½°ú °°´Ù.
algorithms.pdf (320.39 KB)