Hi! I'm new to this forums! I have the following problem:
We have n sets with k(n) elements each. Each set has unique elements, however some elements in the set A can be the same as some in set B. C(A,B) is the set of elements that A and B have in common.
Now we choose one element from each set to form a n-sized vector. All values in this vector must be unique. The first element of the vector must be from the first set, second from the second one and so on...
Question: How do i calculate the number of possible vectors?
Example:
set 1: ( 3 5 7 8 )
set 2: ( 1 7 8 )
set 3: ( 5 8 9 )
set 4: ( 6 )
n = 4;
k(1) = 4; k(2) = 3; k(3) = 3; k(4) = 1;
C(1,2) = { 8,7}; C(1,3) = {5,8}; C(1,4) = {}; C(2,3) = { 8 }; C(2,4) = {}, C(3,4) = {}
valid vector: [ 3, 1, 5, 6]
invalid vector: [ 5, 8, 5, 6] - two fives -> not good
number of possible vectors (solution of the problem) = 22
------------
I have found the solution if we only have two sets:
( k(1) - |C(1,2)| ) * k(2) + |C(1,2)| * ( k(2) - 1 )
However i need a general formula for n sets.
We have n sets with k(n) elements each. Each set has unique elements, however some elements in the set A can be the same as some in set B. C(A,B) is the set of elements that A and B have in common.
Now we choose one element from each set to form a n-sized vector. All values in this vector must be unique. The first element of the vector must be from the first set, second from the second one and so on...
Question: How do i calculate the number of possible vectors?
Example:
set 1: ( 3 5 7 8 )
set 2: ( 1 7 8 )
set 3: ( 5 8 9 )
set 4: ( 6 )
n = 4;
k(1) = 4; k(2) = 3; k(3) = 3; k(4) = 1;
C(1,2) = { 8,7}; C(1,3) = {5,8}; C(1,4) = {}; C(2,3) = { 8 }; C(2,4) = {}, C(3,4) = {}
valid vector: [ 3, 1, 5, 6]
invalid vector: [ 5, 8, 5, 6] - two fives -> not good
number of possible vectors (solution of the problem) = 22
------------
I have found the solution if we only have two sets:
( k(1) - |C(1,2)| ) * k(2) + |C(1,2)| * ( k(2) - 1 )
However i need a general formula for n sets.