Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given n items and each item i has a value vi (vi 0) and weight wi. Given a total weight limit S, you

You are given n items and each item i has a value vi (vi  0) and weight wi. Given a total weight limit S, you are asked to select a subset of items whose total weight does not exceed S, and whose total value is maximized. Note: you can take a fraction of any item. For example, if you take a fraction k of item i, you gain value k  vi and weight k  wi is added. 1. Please design a greedy algorithm that yields the optimal solution (4 pts). 2. Prove the algorithm yields the optional solution using the exchange argument 

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_2

Step: 3

blur-text-image_3

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

Elements Of Chemical Reaction Engineering

Authors: H. Fogler

6th Edition

013548622X, 978-0135486221

More Books

Students also viewed these Algorithms questions