Find a set of values to find maximum possible sets from a list of sets


Find a set of values to find maximum possible sets from a list of sets



SET =[a,b,c,d,e,1,2,3,4,5]



ELEMENTS=a,b,c....4,5



The SET can have minimum of 1 ELEMENT and maximum of 10. First five ELEMENTS of SETS belongs to group "A" and rest with Group "B".
Problem statement:
Assume we have 500 SETS in a list. We have to select any number of sets from that list. Based on those selection, we will get UNIQUE ELEMENTS from all selected sets.
Now from all of those unique elements, we need to find out combination of ELEMENTS from which we can form maximum numbers of SETS from selected SETS.



I need an Algorithm to perform above task with least complexity.





Please show us some effort here.
– Tim Biegeleisen
Jul 3 at 6:41





so what i am doing is : i am getting the unique elements with their count of repetition. Then starting with max used element, finding the sets using it, then from those sets i am again finding the max used element and repeating the same cycle. At the same time i am removing the sets which are not using that maximum used element.
– vishu srivastava
Jul 3 at 6:52





Please post CODE!!! Most of us are professional developer who can read code faster than strange requirements.
– OldCurmudgeon
Jul 3 at 7:17





This can be formulated as a Linear Programming problem. Can you solve it from this point?
– Trifon
Jul 3 at 7:59





@OldCurmudgeon Here i am just asking for the right approach not the code!!
– vishu srivastava
Jul 3 at 8:24









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

PHP contact form sending but not receiving emails