I'm aware of the general k-center approximation algorithm, but my professor (this is a question from a CS class) says that in a one-dimensional space, the problem can be solved (optimal solution found, not an approximation) in O(n^2)
polynomial time without depending on k
or using dynamic programming.
A general description of the k-center problem: Given a set of nodes in an n-dimensional space, cluster them into k
clusters such that the "radius" of each cluster (distance from furthest node to its center node) is minimized. A more formal and detailed description can be found at http://en.wikipedia.org/wiki/Metric_k-center
As you might expect, I can't figure out how this is possible. The part currently causing me problems is how the runtime can not rely on k
.
The nature of the problem causes me to try to step through the nodes on a sort of number line and try to find points to put boundaries, marking off the edges of each cluster that way. But this would require a runtime based on k
.
The O(n^2)
runtime though makes me think it might involve filling out an nxn
array with the distance between two nodes in each entry.
Any explanation on how this is works or tips on how to figure it out would be very helpful.
k
times and calculate the objective function each step. But at this point it sounds like it'll be a dynamic programming algorithm (which isn't necessary) $\endgroup$