added k-means code