Presumming we have a table in visual foxpro, which has two fields,
named: no1 of numeric type,which contains a number of maximum 2 digits,
no2 identical with the first filed.
The demand is to find out the minimum set of digits with the following
property:
from every row from the table, at least one of the two fields is
contained in the set....
For example :

first row: | 1 | 2 |
second row: | 1 | 3 |
........ | 2 | 5 |
........ | 2 | 6 |

for this example, the minimum set is: { 1, 2 }

Another example :

| 3 | 2 |
| 5 | 6 |
| 1 | 2 |
| 2 | 3 |
| 1 | 6 |
| 2 | 5 |
| 1 | 8 |

for the example above, the minimum set is :
( 1,2,6, } or { 2,6,8 } or { 1,2,5 }

Can someone solve this problem in visual foxpro?



--
infstud
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Re: I have a problem to solve... by swdev2

swdev2
Sun Dec 04 21:08:33 CST 2005

Wow - this sounds like a CS class problem -
Please let me know which class you are taking, the name of the teaching, and
his/her contact details -
cause I want to interview the teacher for an upcoming issue of TerraFox
Magazine .
You don't have to post the info here - just visit the terrafox.net site and
do a priv email.

regards [Bill]

--
===================
William Sanders / EFG VFP / mySql / MS-SQL
www.efgroup.net/vfpwebhosting
www.terrafox.net www.viasqlserver.net

"infstud" <infstud.1zjkxx@mail.codecomments.com> wrote in message
news:infstud.1zjkxx@mail.codecomments.com...
>
> Presumming we have a table in visual foxpro, which has two fields,
> named: no1 of numeric type,which contains a number of maximum 2 digits,
> no2 identical with the first filed.
> The demand is to find out the minimum set of digits with the following
> property:
> from every row from the table, at least one of the two fields is
> contained in the set....
> For example :
>
> first row: | 1 | 2 |
> second row: | 1 | 3 |
> ........ | 2 | 5 |
> ........ | 2 | 6 |
>
> for this example, the minimum set is: { 1, 2 }
>
> Another example :
>
> | 3 | 2 |
> | 5 | 6 |
> | 1 | 2 |
> | 2 | 3 |
> | 1 | 6 |
> | 2 | 5 |
> | 1 | 8 |
>
> for the example above, the minimum set is :
> ( 1,2,6, } or { 2,6,8 } or { 1,2,5 }
>
> Can someone solve this problem in visual foxpro?
>
>
>
> --
> infstud
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>



Re: I have a problem to solve... by Al

Al
Mon Dec 05 11:00:07 CST 2005

1. go thru and find any pair where the 2 #'s are the same
these must be in the final set
2. eliminate from further consideration all where 1 of pair in set of (1)
above
3. get max count of every number from 0 to 100
4. add these 1 at a time until all satisfied

al


"infstud" <infstud.1zjkxx@mail.codecomments.com> wrote in message
news:infstud.1zjkxx@mail.codecomments.com...
>
> Presumming we have a table in visual foxpro, which has two fields,
> named: no1 of numeric type,which contains a number of maximum 2 digits,
> no2 identical with the first filed.
> The demand is to find out the minimum set of digits with the following
> property:
> from every row from the table, at least one of the two fields is
> contained in the set....
> For example :
>
> first row: | 1 | 2 |
> second row: | 1 | 3 |
> ........ | 2 | 5 |
> ........ | 2 | 6 |
>
> for this example, the minimum set is: { 1, 2 }
>
> Another example :
>
> | 3 | 2 |
> | 5 | 6 |
> | 1 | 2 |
> | 2 | 3 |
> | 1 | 6 |
> | 2 | 5 |
> | 1 | 8 |
>
> for the example above, the minimum set is :
> ( 1,2,6, } or { 2,6,8 } or { 1,2,5 }
>
> Can someone solve this problem in visual foxpro?
>
>
>
> --
> infstud
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>