Chapter 6: Q3E (page 192)
Yuckdonald’s is considering opening a series of restaurant along Quaint Valley Highway(QVH). The n possible locations are along a straight line, and the distances of these locations from the start of QVH are, in miles and in increasing order,. The constraints are as follows:
At each location, Yuckdonald may open at most one restaurant. The expected profit from opening a restaurant at location i is given as, whereand.
Any two restaurants should be at least k miles apart, where k is a positive integer.
Give an efficient algorithm to compute the maximum expected total profit subject to the given constraints.
Short Answer
In this question certain thing we need to notice,
- “At each location, Yuckdonald may open at most one restaurant”.
This means either no restaurant or at most one restaurant can be opened in each location.
- “Any two restaurants should be at least k miles apart, where k is a positive integer”.
This means if suppose there are two location and, then each restaurant can be open only if: