تم الحل ✓
categoryهندسة صناعية وإنتاج
schoolبكالوريوس
event_available2026-07-13
السؤال
Transcribed Image Text:
1. 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
1, 2,...,n. For each location, you have an estimated revenue r₁1, 2,..., Tn. 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 x and xj, we must have x, x 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 your algorithm should run in O(n) time.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.