Question: ( 3 0 ) ( a ) Let P 1 , P 2 , dots, P n be a set of n programs that are
a Let dots, be a set of programs that are to be stored on a memory chip of capacity Program requires amount of space. Note that and s are all integers. We assume that dots The problem is to select a maximum subset of the programs for storage on the chip. A maximum subset is one with the maximum number of programs in it Give a greedy algorithm that always finds a maximum subset such that You also have to prove that your algorithm always finds an optimal solution. Note that a program is either stored on the chip or not stored at all in other words, you do not store part of a program
b Suppose that the objective now is to determine a subset of programs that maximizes the amount of space used, that is minimizes the amount of unused space. One greedy approach for this case is as follows: As long as there is space left, always pick the largest remaining program that can fit into the space. Prove or disprove that this greedy strategy yields an optimal solution.
c We can formulate the problem in b into a decision problem as follows: given programs of sizes dots, with chip capacity and integer is there a packing of programs onto the chip such that the unused space is or less. Show that this decision problem is NPcomplete.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
