سلام
می تونین از این روش استفاده کنین
\documentclass{article}
\usepackage{algorithm}
\usepackage{listings}
\usepackage{xepersian}
\lstset{
language=java,
numbers=left,
tabsize=2,
showstringspaces=false,
showspaces=false,
numberstyle=\tiny,
xleftmargin=4em,
resetmargins=true,
}
\settextfont{Yas}
\setdigitfont{Yas}
\begin{document}
\begin{algorithm}
\begin{latin}
\begin{lstlisting}
DBSCAN (D, eps, MinPts)
C=0 for each point P in dataset D
if P is visited
continue next point
mark P is visited
NieghborPts = regionQuery (P, eps)
if sizeof (NieghborPts) < MinPts
else
C= next cluster
expandCluster (P, NieghborPts, $C$, eps, MinPts)
\end{lstlisting}
\end{latin}
\end{algorithm}
\end{document}