The proposed FKMWC algorithm can be extended to handle high-dimensional or sparse datasets by incorporating different distance metrics that are suitable for such datasets. For high-dimensional datasets, kernel distances can be utilized to map the data into a higher-dimensional space, allowing for more complex relationships to be captured. This extension would involve computing the similarity between data points using kernel functions, such as the Gaussian radial basis function. Additionally, for sparse datasets, the algorithm can adapt by using distance metrics that are robust to sparsity, such as the K-nearest neighbor distance. This approach would involve computing distances based on the nearest neighbors of each data point, which can be more effective in capturing the underlying structure of sparse datasets.