All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2022 (Shift 1)

Directions (Q91–95): For a knapsack problem, the profits and weights of 7 items are P = {9, 5, 2, 7, 6, 16, 9} and W = {2, 5, 6, 11, 1, 9, 3}.

What is the maximum value of items you can carry if maximum weight allowed is 25 with a fractional knapsack?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. 48.1

Explanation

With capacity 25: items 5, 1, 7, 6 give 40 at weight 15; item 2 adds 5 (weight 20, profit 45); 5/11 of item 4 adds 7 × 5/11 ≈ 3.18. Total ≈ 48.1.

More Data Structures and Algorithms questions