Menu

[solved]-1 Write C Program Inputs Given User Program Using Dynamic Programming Recurrence Don T Mem Q39064852

1. Write a C-program (inputs to be given by the user and not inthe program) using dynamic programming recurrence (don’t domemoization/bottom-up), which will most likely takeexponential time

Suppose we modify the activity selection problem to allowrequests for the conference room to come with bribes (or, if you’remore moral, “priorities”). Our goal now is to maximize our totalbribe (or priority) income. This might mean we DON’T schedule thelargest number of activities.

In this version, each activity also has a bribe amount (apositive integer). Instead of maximizing the number of activities,you’re maximizing the total bribes paid by each activity that getsscheduled.

This is a Dynamic Programming problem, and the recurrence shouldlook like this:

Profit(i,j) = total profit made by scheduling tasks i to theend, if task j was the last task scheduled. THE TASKS ARE SORTED BYFINISH TIME (obviously when you write the program, you should dothis first)

= 0 if i > n (out of tasks)

= Profit(i+1,j) if i’s starting time is before j’s finish time.(It’s impossible to schedule i, move on to the next feasible taskif there is one)

= ??? (this is the recursive part for you to do) otherwise

2. Write a C-program (inputs to be given by the user and not inthe program) to Modify the above Dynamic Programming solution aboveto either calculate the profit using memoization or using thebottom-up method described in class. This new version should beO(N^3) or faster.

Expert Answer


Answer to 1. Write a C-program (inputs to be given by the user and not in the program) using dynamic programming recurrence (don’t… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *