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.
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
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?