Dynamic Programming21 sections · 916 units
Open in Course

Server Allocation - Problem Statement

Partitioning with cost

Allocate nn tasks to kk servers. Server cost = sum of (task weights)^2 for assigned tasks. Find the lowest total. dp[j][i]dp[j][i] = min cost to assign first ii tasks to jj servers.

Transition: split at some point for the jj-th server. Cost of assigning [l,r][l, r] to one server = (t=lrwt)2(\sum_{t=l}^{r} w_t)^2. Use prefix sums. QI holds for this squared-sum cost. Apply D&C: O(knlogn)O(kn \log n). The squared sum cost encourages even distribution. Putting all tasks on one server gives high cost.