I have 5 sets: s0, s1, s2, s3, s4 such that
s0 = {0,1,2,3,4}
s1 = {1,2,3,4}
s2 = {2,3,4}
s3 = {3,4}
s4 = {4}
NOTE: Next set will follow that order. And elements [0,5) in them are nothing but indices of another array. So the elements would never exceed 4 if the are representing indices of an array with size 5.
Now, I want to perform XOR operation of some of these sets to find new set of indices to access array elements.
I can perform normal set XOR operations here, but that seems time consuming.
So, is it possible to get the next set of indices after XORing some of the given sets?
Update:
For example,
let's assume, initially, snew_set = {0,2,4}
snew_set = s0 ^ s2 ^ s4 = {0,1,4}
snew_set = s0 ^ s1 ^ s4 = {0,4}
snew_set = s0 ^ s4 = {0,1,2,3}
and soon.
The above is a recursive pattern which depends on its previous set values. Is there any other efficient way to calculate the next snew_set rather than literally finding common elements one by one?
NOTE: Elements in the set, that is {0,1,2,3,4......., (n-1)} are limited by n