Give N=no. of players
K=No. of fans
likeMatrix=It is a sting array of size K where each element of array have size N.
(contains 0 and 1 only) where if a[i][j] ==1 represents fan(i) likes player(j)
Ex. N=5
K=3
like={ "10101","00001","01011","...","...." }
Count min. no. of players required to put in team such that each fan likes atleast one player.
I think it is minimum bipartite matching(just opposite to maximum bipartite matching). So, can anybody tell me how to solve it?
What about using a greedy solution.
1. Pick the player with maximum number of fans.
2. Then remove all those fans.
Repeat this till each fan has been picked up.
UPD: Thinking more, isn't this the same as Set Cover Problem which is NP-Complete.
This algo is not correct.
Consider a case:
1001
1000
0100
0100
0011
0011
UPD: There was a small typo:
The case was:
1000
1001
0100
0101
0010
0011
More formal :
Minimize number of Xi = 1
(XA11 or XA12 or ... or XA1K1) and ... and (XAi1 or XAi2 or ... or XAiKi) and ... and (XAn1 or XAn2 or ... or XAnKn) = 1
and it look like "The Minimum Assignment Problem" link , "It is shown that the Minimum Assignment Problem is NP-complete for 2-CNF and Horn CNF formulae".