Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 3 0 ) ( a ) Let P 1 , P 2 , dots, P n be a set of n programs that are

(30)(a) Let P1,P2,dots,Pn be a set of n programs that are to be stored on a memory chip of capacity L. Program Pi requires ai amount of space. Note that L and ai's are all integers. We assume that a1+a2+dots+an>L. The problem is to select a maximum subset Q 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 Q such that PiinQ?aiL. 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 n programs of sizes a1,a2,dots,an, with chip capacity L, and integer k, is there a packing of programs onto the chip such that the unused space is k or less. Show that this decision problem is NP-complete.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Create an intervention for treating implicit racial bias.

Answered: 1 week ago