>Hi,
>
>I have 10 comma delimited number pairs:
>1,2
>1,3
>1,4
>1,5
>2,3
>2,4
>2,5
>3,4
>3,5
>4,5
>
>I have 10 letters. Each of the letters can represent 3 of the of the comma delimited pairs. ie:
>
>a 1,2 1,3 2,3
>b 1,2 1,4 2,4
>c 1,2 1,5 2,5
>d 1,3 1,4 3,4
>e 1,3 1,5 3,5
>f 1,4 1,5 4,5
>g 2,3 2,4 3,4
>h 2,3 2,5 3,5
>i 2,4 2,5 4,5
>j 3,4 3,5 4,5
>
>How do I figure out the least number of letters that will represent all of the comma delimited number pairs. ie: I was able to eye ball the list and figure out that j,i,f,a will do it. But how do you program logic. How about representing the numbers in data tables and using joins and unions. Any takers?
>
>Neil
This looks like a very challenging problem, and the solution I outline isn't exactly simple. I think you must first normalize the second part of your data, to simplify accessing it:
a 1,2
a 1,3
a 2,3
b 1,2
b 1,4
b 2,4
etc.
Thus, you only have to analyze the contents of a single field, instead of three fields. Also, you have the flexibility of one letter representing more than three pairs, or less.
Now comes the difficult part. I suspect that you have to do some systematic testing, using a recursive function. This can take a very long time to run, depending on the amount of data.
I don't know whether there is a shorter way to do this.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)