lists/unions/intersections:



Hello,


Could you please help me to solve the following problem.
Rules:
1) There "N" number of lists. Each list has W(N) number of elements
2) Each list can be fully independent of other lists or it can have
intersection with one or more other lists or it can be identical to one
or more other lists.
3) I need to combine these lists into the new "M" number of lists
of size that is less then K. The goal is to produce the smallest
possible number of lists
4) Size K is greater then any one size of original lists
5) New lists must always include all elements found in original lists
minus the duplicates.

Here is an example:

Combine seven lists below into new lists. New lists must contain less
then 10 elements
list_1: { a, b, c, d ,e }
list_2: { c, d, a, g }
list_3: { a, g, s, h, y }
list_4: { t, r, n, l, o }
list_5: { c, f, g, s, w, y }
list_6: { n, y, r, s }
list_7: { k, b, s }

list_1+list_2: { a, b, c, d, e, g }
list_3 + list_5; { a, g, s, h, y, c, f, w, y }
list_4 + list_6 + list_7: { t, r, n, l, o, y, s, k, b }

Thank you!
Oleg

.



Relevant Pages

  • Re: intersection
    ... > If one of the lists contains duplicate elements, ... > intersection of two sets A and B is the the set of all x, ... statement than the "may have duplicates" line in the spec. ... With that much description of an implementation dependency that ...
    (comp.lang.lisp)
  • Re: intersection
    ... ``If one of the lists contains duplicate elements, ... INTERSECTION, don't count on it to normalize the results to a proper ... set-like sequence with no duplicates, but also don't count on it to ... items are in the first set. ...
    (comp.lang.lisp)
  • Re: intersection
    ... > result of performing an intersection on lists containing duplicate ... > duplicates that may show up in the result. ... > number of members in the result is so undefined that even within the ... The semantics of INTERSECTION are very rigid when you give it lists ...
    (comp.lang.lisp)
  • Re: intersection
    ... > result of performing an intersection on lists containing duplicate ... > number of members in the result is so undefined that even within the ...
    (comp.lang.lisp)
  • Re: Iterating & Comparing String Data Sets Efficiently?
    ... to find which strings each set has in common. ... it's slow (the real data is quite ... SBCL) - intersection for two sets of length N and K is O ... function to traverse lists in parallel, you would get O) ...
    (comp.lang.lisp)