\documentclass{article}
\usepackage{amsmath}
\usepackage{caption,tikz}
\usepackage{algorithm}
\usepackage{xepersian}
\settextfont{Yas}
\setdigitfont{Yas}
\begin{document}
\listofalgorithms
\newtheorem {الگوریتم}{algorithm}
\begin{algorithm}
\begin{latin}
 DBSCAN (D, eps, MinPts) \{ \\
 \hspace{0.5cm} $C=0$  for each point P in dataset D \{\\
  \hspace{0.6cm} if P is visited\\
  \hspace{0.6cm} continue next point \\
  \hspace{0.6cm} mark P is visited  \\
  \hspace{0.6cm} NieghborPts = regionQuery (P, eps)  \\
  \hspace{0.6cm} if sizeof  (NieghborPts)  < MinPts \\
   \hspace{0.6cm} else  \{ \\
        \hspace{0.7cm} $C=$ next cluster \\
     \hspace{0.7cm} expandCluster (P, NieghborPts, $C$, eps, MinPts) \\
    \hspace{0.6cm}  \} \\
    \hspace{0.5cm} \} \\
   \hspace{0.4cm} \} \\
\end{latin}
\end{algorithm}
\end{document}

