implemented naive k-means algorithm