Processor distribution and proportional apportionment
I saw an interview problem about assigning identical processors to embarrassingly parallel jobs. The running time of a job equals the running time on a single processor divided by the number of processors. We are interested in minimizing the maximum running time. Formally, we get the following problem.
Given positive reals and positive integer , find non-negative integers , such that and is minimized.
If there is no integral requirement on ’s, then the problem is easy. Let . There is a closed solution of , and .
Otherwise, it is easy to check if is a feasible solution. is feasible iff . Therefore one can apply binary search, and get the result in time.
One can also get a time algorithm. First compute . Greedily find a such that is maximized, and decrease by . We stop when we have . This takes per operation using a binary search tree.
Linear time algorithm also exists. It is connected to proportional apportionment. This is the problem of finding the smallest , such that . Cheng and Eppstein found a time algorithm [1]. Reitzig and Wild found a simpler algorithm later [2].
There is a similar interview problem. Given points on the real line, add more points, such that it minimizes the maximum length between adjacent points. The problem is the same as the following one.
Given positive and positive integer , find non-negative integers , such that and is minimized.
The linear time algorithm for proportional apportionment should also work for the above problem. It is interesting how much can we change the problem before the linear time algorithm no longer works.