\begin{algorithmic}
\STATE \textbf{Input: } $D$ - Data points to be clustered, $n$ - number of data points in $D$, $k$ - number of clusters
\STATE \textbf{Initialize: } A list of cluster centroids $C_{1..k}$ to random initial data points, $m$ representing a list of cluster memberships
\FOR {each data point $d_i \in D$}
	 \STATE $m(p_i) = \underset{k \in \lbrace 1..n \rbrace}{argmin}$ distance($p_i$, $c_k$)
\ENDFOR
\WHILE {cluster membership $m$ has changed}
	\FOR {each $c_i \in C$}
	\STATE $c_i = \frac{1}{ |m_i|} \underset{x_j \in m_i}{\Sigma}x_j$
\ENDFOR
\FOR {each data point $d_i \in D$}
	 \STATE $m(p_i) = \underset{k \in \lbrace 1 to n \rbrace}{argmin}$ distance($p_i$, $c_k$)
\ENDFOR
\ENDWHILE
\end{algorithmic}