let pr[i] be answer to sub-problem 1..i and there is restaurant built at i.
(maximum expected total profit)

How do we calculate pr[i]? Expected profit from location i + max. pr[j], where
location of j is at least k apart from location i.
pr[i] = p[i] + max(pr[j]), where j is between 1..i-1 and m[i]-m[j] >= k

answer to your problem is max(pr[i]) where i=1..n

You can do it in O(n), keeping max. pr[i] up to now additionally.

On 3/19/07, Ez_Alg <[EMAIL PROTECTED]> wrote:
>
> BurgerKing's is considering opening a series of restaurants along
> RiverSide Freeway. The n possible locations are along a straight line,
> and the distances of these locations from the start of RiverSide
> Freeway are, in miles and in increasing order,m1;m2; : : : ;mn. The
> constraints are as follows: At each location, BurgerKing's may open at
> most one restaurant. The expected profit from opening a restaurant at
> location i is pi, where pi > 0 and i = 1; 2; : : : ; n. Any two
> restaurants should be at least k miles apart, where k is a positive
> integer. what is an efficient algorithm to compute the maximum
> expected total profit subject to the given constraints.
> any help would be appriciated
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to