Question: The minimum distance between 2restaurants is 20. There is no maximum. Eachnode is associated with a value (revenue). We want sequence with highest revenue. Suppose

The minimum distance between 2restaurants is 20. There is no maximum. Eachnode is associated with a value (revenue). We want sequence with highest revenue.
Suppose you want to place fast food restaurants at various locations along a highway. For simplicity, let us model the highway as the X-axis. You have a list of potential locations for the fast food restaurants x1, x2, ..., xn. For each location, you have an estimated revenue r1, r2, ..., rn. However, for environmental reasons, the distance between two fast food restaurants must be at least 20 kilometers, that is for two con- secutive fast food restaurants r; and xj, we must have rj - rj > 20. Design a placement algorithm that will optimize your estimated revenue. For example, if your possible fast food restaurant locations are (2, 17, 24, 32, 48), and your estimated revenue is (9, 22, 11, 2, 12), then your optimal placement is one fast food restaurant at location 17 and one at 48 which gives you an estimated revenue of 22+12=34. It is possible to place a fast food restaurant at locations 2, 24, 48 however, that only gives you an estimated revenue of 9+11+12 = 32 which is less revenue. However, if your estimated revenue is (9, 22, 14, 2, 12), that is the revenue of location 24 is 14 instead of 11, then the optimal solution would be to place the fast food restaurants at 2, 24, 48. (a) Design an algorithm to find a placement that maximizes revenue. (b) Prove your algorithm is correct. (c) Analyze the run time of your algorithm. For full marks, your algorithm should run in O(n) time. Suppose you want to place fast food restaurants at various locations along a highway. For simplicity, let us model the highway as the X-axis. You have a list of potential locations for the fast food restaurants x1, x2, ..., xn. For each location, you have an estimated revenue r1, r2, ..., rn. However, for environmental reasons, the distance between two fast food restaurants must be at least 20 kilometers, that is for two con- secutive fast food restaurants r; and xj, we must have rj - rj > 20. Design a placement algorithm that will optimize your estimated revenue. For example, if your possible fast food restaurant locations are (2, 17, 24, 32, 48), and your estimated revenue is (9, 22, 11, 2, 12), then your optimal placement is one fast food restaurant at location 17 and one at 48 which gives you an estimated revenue of 22+12=34. It is possible to place a fast food restaurant at locations 2, 24, 48 however, that only gives you an estimated revenue of 9+11+12 = 32 which is less revenue. However, if your estimated revenue is (9, 22, 14, 2, 12), that is the revenue of location 24 is 14 instead of 11, then the optimal solution would be to place the fast food restaurants at 2, 24, 48. (a) Design an algorithm to find a placement that maximizes revenue. (b) Prove your algorithm is correct. (c) Analyze the run time of your algorithm. For full marks, your algorithm should run in O(n) time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
