(Solution Document) Use dynamic programming. The input consists of a sequence R = R1, ,Rn of non-neg


Use dynamic programming. The input consists of a sequence R = R1, · · · ,Rn of non-negative integers, and an integer k. The number Ri represents the number of users requesting some particular piece of information at time i (say from a www server). If the server broadcasts this information at some time t, the requests from all the users who requested the information strictly before time t have already been satisfied, and requests arrived at time t will receive service at the next broadcast time. The server can broadcast this information at most k times.

The goal is to pick the k times to broadcast in order to minimize the total time (over all requests) that requests/users have to wait in order to have their requests satisfied.

As an example, assume that the input was R = 3, 4, 0, 5, 2, 7 (so n = 6) and k = 3. Then one possible solution (there is no claim that this is the optimal solution) would be to broadcast at times 2, 4, and 7 (note that it is obvious that in every

optimal schedule that there is a broadcast at time n + 1 if Rn 6= 0). The 3 requests at time 1 would then have to wait 1 time unit. The 4 requests at time 2 would then have to wait 2 time units. The 5 requests at time 4 would then have to wait 3 time units. The 2 requests at time 5 would then have to wait 2 time units. The 7 requests at time 6 would then have to wait 1 time units. Thus the total waiting time for this solution would be 3 ? 1 + 4 ? 2 + 5 ? 3 + 2 ? 2 + 7 ? 1.

 







About this question:

Pay using PayPal (No PayPal account Required) or your credit card. All your purchases are securely protected by .
SiteLock