update kmeans algorithm