Question: Hi can u pleasee help do this question it consists of a,b,c and d.Thanks Problem 2. Suppose that you are a door-to-door salesman, selling the

Hi can u pleasee help do this question it consists of a,b,c and d.Thanks

Hi can u pleasee help do this question it consists of a,b,c

Problem 2. Suppose that you are a door-to-door salesman, selling the latest innovation in vacuum cleaners to less-than-enthusiastic customers. Today, you are planning on selling to some of the n houses along a particular street. You are a master salesman, so for each house, you have already worked out the amount c of profit that you will make from the person in house i if you talk to them. Unfortunately, you cannot sell to every house, since if a person's neighbour sees you selling to them, they will hide and not answer the door for you. Therefore, you must select a subset of houses to sell to such that none of them are next to each other, and such that you make the maximum amount of money. For example, if there are 10 houses and the profits that you can make from each of them are 50, 10, 12, 65, 40, 95, 100, 12, 20, 30, then it is optimal to sell to the houses 1,4,6,8, 10 for a total profit of $252. Devise a dynamic programming algorithm to solve this problem. (a) Describe in plain English, the optimal substructure present in the problem (b) Define a set of overlapping subproblems that are based on the optimal substructure (c) What are the base case subproblems and what are their values? (d) Write a recurrence relation that describes the solutions to the subproblems (e) Write psuedocode that implements all of this as a dynamic programming algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!