Skip to main content
8 votes
3 answers
1k views

I am trying to solve the problem posed in this question. Here the OP asks that given a 15 element set, its 2^15 element power set be generated in a manner such that the elements of the power set are ...
uran42's user avatar
  • 685
1 vote
2 answers
86 views

I'm looking for a simple way to generate the powerset of an iterable where each element can be "positive" or "negative", but not both in the same combination. There are no ...
upe's user avatar
  • 2,202
0 votes
1 answer
99 views

What is the most efficient way (and/or most idiomatic) to make a modified powerset of vector of 2-tuples in Rust? By modified, what I mean is the following rule (a,b),(c,b) not in any set, for any a,b,...
Karl's user avatar
  • 97
-4 votes
2 answers
99 views

Chat-GPT generated me the following code in Java, but it still doesn't work with equal elements. The supposed output is incorrect, since the equal elements get simply ignored and I can't figure out ...
Eugen's user avatar
  • 250
1 vote
1 answer
157 views

I get an error: working.hs:186:25: error: * Couldn't match expected type: Set (Set a) with actual type: [[a]] * In the expression: union (map (insert x) (powerSet s)) (powerSet s) ...
fistic iasi's user avatar
0 votes
1 answer
57 views

I am trying to solve the problem Subsets using Javascript. The task is to print the powerset i.e., all subsets from an array. In the function below, I am passing an array as a parameter to collect all ...
argcv's user avatar
  • 51
0 votes
2 answers
127 views

I'm having this combination problem where I'm trying to find subsets of matching combinations of 2 items which results in the highest amount of total matches. Every item can only be in a match once. ...
Oehoe's user avatar
  • 61
1 vote
1 answer
121 views

I Have a powerset function which creates a list [[a]] but the largest [a] is worked out first, meaning the whole algorithm has to run before I can get the smaller values. I need a function which ...
ineedhelp's user avatar
-1 votes
2 answers
70 views

The powerset of {1, 2, 3} is: {{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}} I have a String array in java, String elements={"apple","mango","banana"}; ...
Prashant Singh's user avatar
0 votes
1 answer
54 views

I am trying to make a powerset of a list for the first item of that list in ascending order. However, I couldn't find on StackOverflow how to tackle this specific problem. When making a powerset of ...
Mathijsvdk's user avatar
2 votes
1 answer
224 views

The time complexity of this code to create a powerset from distinct integers is listed as O(n * 2^n) at all places including the Leetcode solution. I listed the complexity of each step as a code ...
bucksbros's user avatar
0 votes
2 answers
491 views

I was solving the classic powerset generation using backtracking. Now, let's say, I add another constraint, the output should appear in a specific order. For input = [1, 2, 3], the output should be [[]...
Zabir Al Nazi Nabil's user avatar
0 votes
1 answer
101 views

I am trying to generate all powersets from a given list within a limit of given maximum size. I've found some great answers for how to generate powersets in general and admire the solution using ...
Elphie's user avatar
  • 3
0 votes
0 answers
72 views

I am using a binomial tree as a list with 2^T - 1 'nodes' and want to create a set of subsets that work within some given criteria (outlined below) on the elements of the list. Right now, I use the ...
jodawg's user avatar
  • 1
1 vote
2 answers
477 views

I have implemented a Set datatype in Haskell using Binary search tree. I have not used any of the in-built functions nor imported any module. My set datatype is as follows: data Set a = Empty | Node a ...
user avatar

15 30 50 per page
1
2 3 4 5
16