basic k-means algorithm
temp