It depends on what you call k-means.
The problem of finding the global optimum of the objective function of k-means

NP-hard, where S i
is the cluster i
(and there are k
clusters), x j
is the d
dimensional point in the cluster S i
and ΞΌ i
is the centroid (the middle of the points) of the cluster S i
.
However, the execution of a fixed number of iterations t
standard algorithm takes only O(t*k*n*d)
for n
( d
-dimensional) points, where k
is the number of centroids (or clusters). This is what practical implementations do (often with random restarts between iterations).
The standard algorithm only approximates the local optimum of the above function, like all k-means algorithms that I have seen.
source share