java source code part c

STUCK with your assignment? When is it due? Hire our professional essay experts who are available online 24/7 for an essay paper written to a high standard at a reasonable price.


Order a Similar Paper Order a Different Paper

Dynamic Programming

Suppose you are managing the construction of billboards on the Stephen Daedalus Memorial Highway, a heavily traveled stretch of road that runs west-east 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 Big-O 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:

  1. Source code

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

  3. For 2nd problem instance (n=10): input (M, n, {x1, x2, …xn}, {r1, r2, …rn})  

Writerbay.net

Everyone needs a little help with academic work from time to time. Hire the best essay writing professionals working for us today!

Get a 15% discount for your first order


Order a Similar Paper Order a Different Paper