Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
42 views

Displaying sets and subsets of a string

I am trying to find the subsets and output them with binary representation. EXAMPLE: 000:EMPTY 001:C 010:B 011:B C 100:A 101:A C 110:A B 111:A B C I have the following code that finds all subsets ...
Clueless's user avatar
-1 votes
1 answer
1k views

Partitioning the array into k non-empty non-intersecting subsegments such that each subsegment has odd sum

I am new in competitive programming. The other day I was solving this problem You are given an array a consisting of n integers a1,a2,…,an. You want to split it into exactly k non-empty non-...
Hamsa's user avatar
  • 483
-9 votes
2 answers
137 views

Given a positive integer N as input, how do I find the product of the numbers in their subsets?

If N=405, how do I generate all of it's subsets and then find the product of each subset's numbers? Like in this case, the set would be {0,4,5,40,05,45,405} and their products would result in a set {0,...
Aulene De's user avatar
5 votes
2 answers
2k views

Best algorithm to compare a set with a collection of sets

What is the best algorithm to find the sets in a finite collection of sets that are a subset of a specific set? For example, if A = {1, 2} B = {2, 3, 4} C = {3, 5} D = {6} and X = {1, 2, 3, 5} ...
Mohammad's user avatar
  • 117
2 votes
1 answer
1k views

How to generate all unique sub sets of length k of an array c++

I need a way to generate all unique sub sets of length k of an array, similar to itertools.combinations() in python. I am trying to get these sets for association mining until the support is less than ...
that_guy's user avatar
  • 2,425
7 votes
4 answers
2k views

Best way to find a subset of a set from a group of sets

First, sorry for the ambiguous title. Assume I have the following group of sets: Group 1 s1 = ( x1, y1 ) s2 = ( x2 ) Group 2 m1 = ( x1, y1, y2 ) m2 = ( x1 ) m3 = ( x1 , x2 ) For each of the sets ...
Luchian Grigore's user avatar