Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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.
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?