Greedy Algorithms8 sections · 316 units
Open in Course

Problem - Fractional Knapsack

Take fractions

Items have weight and value.

You have capacity W.

You can take fractions of items. Maximize value.

Example: items = [(60,10), (100,20), (120,30)], W = 5050. Format: (value, weight). Ratios: 66, 55, 44. Take all of item 11 (weight P5, value P6). Take all of item 22 (weight P8, value P9). Take 22/33 of item 33 (weight P11, value P12). Total: 240240.