Name of this algorithm for supervised cluster assignment
K means clustering kind of works like this.
It uses the Lloyd algorithm, which basically has two steps.
Per each new sample:
 1) Choose the best cluster, by calculating the minimum distance to available clusters mean.
 2) Recalculate chosen cluster mean.