Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started