\::Dokud $l \le r$, opakujeme:
\:::Dokud $X[l]<p$: $l\leftarrow l+1$.
\:::Dokud $X[r]>p$: $r\leftarrow r-1$.
-\:::$X[l] \leftrightarrow X[r]$.
-\:::$l\leftarrow l+1$, $r\leftarrow r-1$.
+\:::Je-li $l\le r$:
+\::::$X[l] \leftrightarrow X[r]$
+\::::$l\leftarrow l+1$
+\::::$r\leftarrow r-1$
\:$\<Sort>(X, a, r)$, $\<Sort>(X, l, b)$.
\endalgo