Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [latex]
- [+preamble]
- \usepackage{amsmath}
- \usepackage{algorithm}
- \usepackage{algpseudocode}
- [/preamble]
- \begin{algorithm}
- \caption{String Palindromity}
- \begin{algorithmic}[1]
- \Function{IsPalindrome}{string text}
- \State $\textit{min} \gets 0$
- \State $\textit{max} \gets \text{length of }\textit{text}$
- \While{true}
- \If {$min > max$} \Return true
- \EndIf
- \If {$text[min] <> text[max]$} \Return false
- \EndIf
- \State $\textit{min} \gets min + 1$
- \State $\textit{max} \gets max - 1$
- \EndWhile
- \EndFunction
- \end{algorithmic}
- \end{algorithm}
- [/latex]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement