Which container can hold more information?

Hi,
I'm working with subsets of integers and using a structure vector<vector<int>>, but as my number of intergers is 100 and then I have 1.267.650.600.228.230.000.000.000.000.000 (2^100) subsets possible. Is there any data struture able to handle so much information?
You can't store all possible subsets at the same time because that requires a ridiculous amount of data. No computer can handle it. Not even all hard drives in the whole world are enough.

You will have to think of some clever way to use more general rules to describe multiple subsets.
Example:
* All subsets where integer 1 is equal to 50
* All subsets where integer 2 is less than 0
* All subsets where at least one integer is greater than 100 and exactly 2 integers are greater than 500 (this is two rules combined)

The rules could be very complicated, or very simple, it depends on what you are doing.
Last edited on
Thanks Peter87, sorry for my stupid question, LoL!

So, a limitation that I tougth about is the size of the subset. It must be upt to 8-10 integers. Below follows my code to generate these subsets. I will try to improve it limitating its cardinality, do you have any proposition for me?

Thanks a lot.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void SubsetGen(vector<vector<int > > &S, vector<vector<int > > &S_, int i, int n){
  int k_max = pow(2,n); //máximo de subconjuntos possíveis

 //adicionara o nó 'i' ao subconjunto se ele fizer a condição válida
 //set S {k in artificial_set} ordered := {i in V_: k div 2**(ord(i) - 1) mod 2 = 1};
  for (int k = 0; k <= (k_max-1); k++){ //percorrendo os subconjuntos possíveis
    int i_aux = i;
    for(int pos = 1; pos <= n+1; pos++){
        if (int(floor(k/pow(2,(pos-1))))%2 == 1)
            S[k].push_back(i_aux); //adiciona ao fim da lista                   
        else
            S_[k].push_back(i_aux);
        i_aux++;
    }
  }
}
Last edited on
Topic archived. No new replies allowed.