java source code part C
Dynamic Programming
Suppose you are managing the construction of billboards on the Stephen Daedalus Memorial Highway, a heavily traveled stretch of road that runs westeast for M miles. The possible sites for billboards are given by numbers x1, x2, . . . , xn, each in the interval [0, M] (specifying their position along the highway, measured in miles from its western end). If you place a billboard at location xi, you receive a revenue of ri > 0. Regulations imposed by the county’s Highway Department require that no two of the billboards be within less than or equal to 5 miles of each other. You’d like to place billboards at a subset of the sites so as to maximize your total revenue, subject to this restriction.
Example. Suppose M = 20, n = 4, {x1, x2, x3, x4} = {6, 7, 12, 14}, and {r1, r2, r3, r4} = {5, 6, 5, 1}. Then the optimal solution would be to place billboards at x1 and x3, for a total revenue of 10.
a) Model this problem by defining input and output using appropriate notations for formulation and give an algorithm that takes an instance of this problem as input and returns the maximum total revenue that can be obtained from any valid subset of sites. The running time of the algorithm should be polynomial in n.
Input:
Output:
Steps:
b) Analyze the time complexity of your algorithm: determine the closet bound of the running time function using BigO notations: ____O(n^2)___________ and explain why.
c) Implement the above algorithm. Create two different problem instances with problem size n=10 and 20 respectively. Submit the following material in hard copy:

Source code

For 1st problem instance (n=10): input (M, n, {x1, x2, ...xn}, {r1, r2, ...rn}), solution and the memorization matrix of subproblem solutions

For 2nd problem instance (n=10): input (M, n, {x1, x2, ...xn}, {r1, r2, ...rn})
Tutor Answer
Review from our student for this Answer
Brown University
1271 Tutors
California Institute of Technology
2131 Tutors
Carnegie Mellon University
982 Tutors
Columbia University
1256 Tutors
Dartmouth University
2113 Tutors
Emory University
2279 Tutors
Harvard University
599 Tutors
Massachusetts Institute of Technology
2319 Tutors
New York University
1645 Tutors
Notre Dam University
1911 Tutors
Oklahoma University
2122 Tutors
Pennsylvania State University
932 Tutors
Princeton University
1211 Tutors
Stanford University
983 Tutors
University of California
1282 Tutors
Oxford University
123 Tutors
Yale University
2325 Tutors