GATE Computer Science (CS) 2018 Shift 1 Solved Paper
© examsnet.com
Question : 42
Total: 65
Consider the weights and values of items listed below. Note that there is only one unit of each item.
The task is to pick a subset of these items such that their total weight is not more than 11 kgs and their total value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is denoted by . V opt A greedy algorithm sorts the items by their value-to-weight ratios in descending order and packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy algorithm is denoted by V greedy ,The value of V opt − V greedy is ________.
Item number | Weight in (kgs) | Value in (Rupees) |
1 | 10 | 60 |
2 | 7 | 28 |
3 | 4 | 20 |
4 | 2 | 24 |
- Your Answer:
Go to Question: