Latex アルゴリズム標準

Latex アルゴリズム標準

コードは次のようになります[1]

私が書いたいくつかの疑似コードには、次のものを使用する LaTeX コードがいくつか記述されています。

\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

LaTeX のアルゴリズムに標準があるかどうか、あるいは単に一般的な標準があるかどうか疑問に思っています。

平方根または sqrt(state) を使用するべきでしょうか。配列項目にアクセスするにはstate[i]分数を使用するべきでしょうか、それとも除算記号だけを使用するべきでしょうか。

コードは次のとおりです:

\makeatletter
    \def\BState{\State\hskip-\ALG@thistlm}
    \makeatother
    %this changes the style of the comments 

    \begin{algorithm}
        \caption{Manhattan Distance}\label{euclid}
        \begin{algorithmic}[1]
            \Procedure{ManDist}{$state$}    \Comment{The current puzzle configuration }
            \State$total\gets 0$
            \State$puzzleLength\gets sizeOf(state)$
            \State$dimensions\gets \sqrt{puzzleLength}$
            \For{$i\gets 1, puzzleLength$}  \Comment{Loops through each tile of the puzzle}
                \State $tileValue\gets state[i]$
                \State $expectedRow\gets \dfrac{(tileValue -1)}{dimensions}$
                \State $expectedCol\gets (tileValue -1)\bmod dimensions$
                \State $rowNum \gets \dfrac{i}{dimensions}$
                \State $rowNum\gets i \bmod dimensions$
                \State $total\gets total \texttt{+} \mid{expectedRow-rowNum}\mid\texttt{+}\mid{expectedCol-colNum}\mid$
            \EndFor
            \State \textbf{return} $total$\Comment{The heuristic is the total}
            \EndProcedure
        \end{algorithmic}
    \end{algorithm}

関連情報