Looking for an algorithm for constructing sets A and B

43 Views Asked by At

Is there an algorithm for constructing sets A and B whose combined size is minimum, given a particular subset of all the possible unordered pairs of elements, one from A and one from B?

Example: Sets A and B contain musical notes as their elements. Given a particular set of two-note chords that must be produced, how shall I construct A and B such that the combined number of notes in A and B is smallest?

Can the algorithm (if there is one) be extended to constructing more than two sets with unordered tuples?