Why is Partitioning Around Medoids (PAM) computationally more expensive per iteration than Lloyd's k-means?

Last updated 11 November 2026

  • Lloyd's k-means updates centers in closed form (the mean), so each iteration costs O(n·k·d).

  • PAM's SWAP phase evaluates all k·(n−k) medoid/non-medoid swaps, each re-scoring all points, giving O(k·(n−k)²) per iteration plus O(n²) memory for the distance matrix.

  • The root cause is no closed-form minimizer for arbitrary dissimilarities. FasterPAM, CLARA, and CLARANS reduce the cost.

  • https://en.wikipedia.org/wiki/K-medoids
  • https://www.geeksforgeeks.org/machine-learning/k-medoids-clustering-in-machine-learning/
  • https://arxiv.org/html/2611.09501v1
All Clustering interview questions