How would you go about 开发者_开发知识库testing all possible combinations of additions from a given set N of numbers so they add up to a given final number?
assume that i have an array int [] arr={1,2,4,5,7} and also have number 6 so i need the result to be 01100 that means that 2+4=6 in the array so the result will be 1 if the number in the sum0 otherwi
first off I\'m going to say I don\'t know a whole lot about theory and such. But I was wondering if this was an NP or NP-complete problem. It specifically sounds like a special case of the subset sum
does anyone know a good and efficient algorithm for equal k subsets algorithm ? preferably c or c++ which could handle a 100 element vector maybe with a complexity and time estimation
I came up with a new algorithm to solve the subset sum problem, and I think it\'s in polynomial time. Tell me I\'m either wrong or a total genius.
Let\'s say I want to find all sets of 5 single-digit, non-repeating numbers that add up to 30... I\'d end up with [9,8,7,5,1], [9,8,7,4,2], [9,8,6,4,3], [9,8,6,5,2], [9,7,6,5,3], and [8,7,6,5,4]. Each
Given a collection of positive integers, I want the subset of those integers whose sum is the smallest sum that exceeds a thre开发者_开发知识库shold.Your problem is a variation on the Subset Sum Probl
As you probably know, the SUBSET-SUM problem is defined as determining if a subset of a set of whole numbers sum to a specified whole number. (there is another definition of subset-sum, where a group
I\'m trying to program my TI-83 to do a subset sum search. So, given a list of length N, I want to find all lists of given length L, that sum to a given value V.