week 8 (K-means algorithm) compute centroids function