K-means clustering algorithm