[SOLVED]Get a minimal set whose elements hit all input sets?
Posted: Wed Nov 06, 2013 7:07 pm
Hello,
It's a question about algorithm.
I have some arrays. Each array contains at most 8 values. Each value could be a number in 0 to 7. No dumplicate value in a single array.
Example input for 4 arrays: { [1, 2, 3], [3, 4], [3, 4], [5] }
I want to get a minimal set whose elements hit every input array.
Example output: {3, 5}
3 hits [1, 2, 3] and [3, 4], 5 hits [5], so all input arrays have been hit.
How could I get this minimal hit set?
It's not that much about Pi though.....thanks for any help.
It's a question about algorithm.
I have some arrays. Each array contains at most 8 values. Each value could be a number in 0 to 7. No dumplicate value in a single array.
Example input for 4 arrays: { [1, 2, 3], [3, 4], [3, 4], [5] }
I want to get a minimal set whose elements hit every input array.
Example output: {3, 5}
3 hits [1, 2, 3] and [3, 4], 5 hits [5], so all input arrays have been hit.
How could I get this minimal hit set?
It's not that much about Pi though.....thanks for any help.