Minimize the sum of errors of representative integers

前端 未结 8 2454
滥情空心
滥情空心 2021-02-07 20:15

Given n integers between [0,10000] as D1,D2...,Dn, where there may be duplicates, and n can be huge:

I want to find k distinct represent

8条回答
  •  广开言路
    2021-02-07 20:36

    This is is similar to one-dimensional k-medians clustering.

    The DP I suggested previously won't work; I think we need a table from (n', k', i) to the optimal solution on D1 ≤ … ≤ Dn' with k' representatives of which the greatest is i. Given the bounds on D, the running time is on the order of n2 k with a very large constant, so you should probably adapt one of the heuristics that people use for k-means.

提交回复
热议问题