Hi,

I have a problem whose solution escapes me (i.e.after working through various solutions for several days I have yet to hit upon an elegant one (or even one that works for all cases)).

I have an array of string where each element contains the comma-separated numbers of items that belong to a group (each element is one group). I want to reduce the array so that each item appears only once, where it is first encountered. Moreover, items that always appear together should get their own group (array element).

Here is an example:

Array(0) = 1,4,6
(1) = 1,2
(2) = 8,7,9
(3) = 1,2

should become

(0) = 1
(1) = 4,6
(2) = 2
(3) = 8,7,9

Each item (number) now appears only once. And minimum groups are maintained (such as, 4,6 is one group).

I'd welcome any suggestions.

Jon
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to