implemation of kMeans and binkMeans