algorithm for selecting minimum number of students

Hey guys I am trying do make an algorithm to select a minimum number of students given in and arbitrary g number of groups. students are in groups based on the subjects they take in school. A student can be in multiple subjects. I must design an algorithm that selects minimum number of students across all subjects

Each group can also have n numbers of students.

Example:5 groups
group 1(math) : student a ,b,c,d ,e
group 2(english): student b,c,f,g
group 3(biology): h,i,g,k,s,m,n,o,p
group 4(chemistry): a,f,,n,z
group 5(computing):b,q,y,w

Result: i could create an algorithm that selects the first element of every group so all groups are covered however that isnt efficient
a good efficient minimum would be: b, n

where do I start? what data structures can i use to make it efficient?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!