, optimizing one given the other is easy. Lloyd's algorithm alternates the steps:</p>
<ol type="1">
<li><b>Quantization.</b> Each point \(\bx_i\) is reassigned to the center \(\bc_{q_j}\) closer to it. This requires finding for each point the closest among \(K\) other points, which is potentially slow.</li>
<li><b>Center estimation.</b> Each center \(\bc_q\) is updated to minimize its average distances to the points assigned to it. It is easy to show that the best center is the mean or median of the points,