Question: Dynamic Programming Algorithm (20 points) You are planning to establish a chain of electric vehicle charging stations along the Pacific Coast Highway. There are n
Dynamic Programming Algorithm (20 points) You are planning to establish a chain of electric vehicle charging stations along the Pacific Coast Highway. There are n potential locations along the highway, and the distance between the starting point and location k is dk 0, where k = 1, 2, . . . , n. It is assumed that di < dk for all i < k. These are important constraints: At each location k you can open only one charging station with the expected profit pk. You must open at least one charging station along the whole highway. Any two stations should be at least M miles apart. Design a dynamic programming algorithm to maximize the profit by following these steps: a) Define (in plain English) the sub-problems to be solved (5 points). b) Write a recurrence relation for the sub-problems. Make sure you specify base cases. (7 points). c) Using the recurrence formula in part b, write an iterative pseudocode to find the solution. (5 points). d) What is the complexity of your solution? Explain your answer. (3 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
