\begin{algorithmic}
\STATE Input: $k$ - number of centers; $m$ number of initial points, $n$ - size of a generation
\FOR {$i = 1 to m$}
\STATE Select a point $c_i$ to be an candidate center in the list of centers L
\STATE Assign a weight of $w_i$ to the candidate center
\ENDFOR
\FOR {each data point $p$ in the stream}
\STATE Count = Count + 1
\STATE Find the nearest candidate center $c_i$ to the point $p$
\STATE Move the nearest candidate center using formula: $c_i = \frac{(w_i * c_i + P)}{ (w_i + 1 )}$
\STATE Increment the weight: $w_i = w_i + 1$
\IF { $Count\equiv 0$ mod $n$ } 
\FOR {each center $c_i$ in the list L}
	\STATE Calculate the probability of survival using the formula: $p_i = \frac{w_i}{\Sigma^m_{i=1} w_i}$
	\STATE Select a random number $\delta$ uniformly from [0,1].
	\IF {$p_i > \delta$}
	\STATE Retain the $c_i$ in $L$ for use in the next generation of $n$ points
	\ELSIF {$p_i < \delta$}
	\STATE Remove $c_i$ from $L$ and choose a new point from the current generation as a replacement
	\ENDIF
\ENDFOR
\ENDIF
\ENDFOR
\STATE Group the final $m$ centers from list $L$ into the final $k$ centers based on their Euclidean distances
\end{algorithmic}