subset-sum Questions
6
Solved
Consider this way of solving the Subset sum problem:
def subset_summing_to_zero (activities):
subsets = {0: []}
for (activity, cost) in activities.iteritems():
old_subsets = subsets
subsets = ...
Rubenrubens asked 21/3, 2012 at 17:6
3
Solved
I have A menu dict item as key and price as value. There may exist a combination of item that will be bit cheaper than single item. For exa:
menu = {
('burger',) : 5.00,
('pizza',) : 12.00,
('c...
Hippie asked 2/1, 2014 at 10:12
3
Solved
This was a question on our Algorithms final exam. It's verbatim because the prof let us take a copy of the exam home.
(20 points) Let I = {r1,r2,...,rn} be a set of n arbitrary positive intege...
Apogeotropism asked 17/12, 2013 at 5:8
2
Solved
This is a follow-up to my previous question. I still find it very interesting problem and as there is one algorithm which deserves more attention I'm posting it here.
From Wikipedia: For the case ...
Degeneracy asked 1/4, 2012 at 7:4
2
I have a function 'subsets' which generate all the subsets of a given set:
subsets :: [Int] -> [[Int]]
subsets [] = [[]]
subsets (x:xs) = subsets xs ++ map (x:) (subsets xs)
How can I combine...
Neuroblast asked 4/11, 2013 at 16:35
3
Solved
Given:
array of integers
value K,M
Question:
Find the maximum sum which we can obtain from all K element subsets of given array such that sum is less than value M?
is there a non dynamic programm...
Succedaneum asked 5/8, 2013 at 19:56
1
Solved
The subset sum problem is well-known for being NP-complete, but there are various tricks to solve versions of the problem somewhat quickly.
The usual dynamic programming algorithm requires space t...
Gryphon asked 25/8, 2013 at 19:21
8
Solved
I have a problem related to the subset sum problem and am wondering if the differences make it easier, i.e. solvable in a reasonable amount of time.
Given a value V, a set size L, and a sequence o...
Wholism asked 17/12, 2008 at 20:57
2
Given two lists of numbers and a list of totals (none in any particular order):
a = [1,2,3]
b = [4,5,6]
c = [6,7,8]
How can I find all sets of pairs d where d[k] = (a[i], b[j]) such that c[k] = ...
Blinders asked 28/2, 2013 at 9:38
2
(Before you reply with a link to another SO question or close this as a duplicate please read the question carefully. This is different than the standard variant of this problem and I've searched f...
Emera asked 28/9, 2012 at 9:50
3
given a unsorted set of n integers, return all subsets of size k (i.e. each set has k unique elements) that sum to 0.
So I gave the interviewer the following solution ( which I studied on GeekView...
Cyclone asked 3/5, 2012 at 0:26
3
Solved
How would you use dynamic programming to find the list of positive integers in an array whose sum is closest to but not equal to some positive integer K?
I'm a little stuck thinking about this.
Overdye asked 5/5, 2012 at 18:52
1
I have several arrays of numbers (each element of the array can only take a value of 0 or 1) like this
v1: 1; 0; 0; 1; 1;
v2: 0; 1; 0; 0; 1;
v3: 1; 1; 0; 1; 0;
v4: 1; 0; 0; 1; 0;
v5: 1; 1; 0...
Bis asked 16/12, 2011 at 21:45
1
Solved
Following from these question Subset sum problem and Sum-subset with a fixed subset size I was wondering what the general algorithm for solving a subset sum problem, where we are forced to use EXAC...
Ium asked 23/3, 2012 at 12:14
1
Solved
I've been breaking a sweat over this question I've been asked to answer (it's technically homework).
I've considered a hashtable but I'm kind of stuck on the exact specifics of how I'd make this wo...
Charcot asked 17/12, 2011 at 15:38
1
following Problem:
I have a MySQL database with songs in it. The database has the following structure:
id INT(11)(PRIMARY)
title VARCHAR(255)
album VARCHAR(255)
track INT(11)
duration INT(11)
T...
Coverley asked 14/9, 2011 at 12:34
4
Solved
I have a real-world problem (not homework!) that requires finding the sum of a subset of set A that equals the sum of a subset of some other set B.
A very similar question with a helpful answer is...
Inhalation asked 22/6, 2011 at 17:44
5
Solved
I know this can be done by sorting the array and taking the larger numbers until the required condition is met. That would take at least nlog(n) sorting time.
Is there any improvement over nlog(n)...
Ornis asked 11/5, 2011 at 12:11
3
Solved
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.
Quick starter facts:
Subset sum problem is an NP-c...
Gourmandise asked 26/6, 2010 at 23:1
5
Solved
I was reading about the subset-sums problem when I came up with what appears to be a general-purpose algorithm for solving it:
(defun subset-contains-sum (set sum)
(let ((subsets) (new-subset) (n...
Offer asked 1/3, 2010 at 1:58
4
The problem is the following:
You are given a set of positive integers { a1 , a2 , a3 , ... , an } in which there are no same numbers ( a1 exists only once ,a2 exists only once,...) eg A = {12 , 5...
Twocolor asked 8/2, 2009 at 11:21
4
Solved
I'm looking for an algorithm which can take two sets of integers (both positive and negative) and find subsets within each that have the same sum.
The problem is similar to the subset sum problem ...
Cilicia asked 14/1, 2009 at 16:42
© 2022 - 2024 — McMap. All rights reserved.