implemented k-means with kd tree