Question discussion

What are the solutions for the following sum of a subset problem?w[1:5] = {2, 7, 8, 9, 15}; Sum required = 171 means the item is included.0…

3754Medium DSSSB TGT Computer Science 0 replies 2 views
0

What are the solutions for the following sum of a subset problem?

w[1:5] = {2, 7, 8, 9, 15}; Sum required = 17

1 means the item is included.

0 means the item is excluded.

  • A11100; 10101; 00110
  • B11100; 10001; 00110
  • C11000; 10001; 00110
  • D11100; 10101; 00111
Correct answer: B

Explanation

Subsets of {2, 7, 8, 9, 15} that add up to 17: {2, 7, 8} = 11100, {2, 15} = 10001 and {8, 9} = 00110.

Discussion 0

Nobody has replied yet. Start the discussion!