Question: Modify the algo given in Problem 1 of Problem Set 11 to solve the following (very similar) problem: We are given n different positive integers:
Modify the algo given in Problem 1 of Problem Set 11 to solve the following (very similar) problem: We are given n different positive integers: a1, a2, . . . , an and another integer b. We want to determine how many different choices we have to express b as the sum of some of the ai 's (each ai can be used at most once in the sum). Design an algo for this problem, the running time should be O(nb)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
