> Richard O'Keefe
> on Fri, 6 Dec 2019 12:18:50 +1300 writes:
> This particular task is not a problem about R.
> It is a problem n combinatorics.
> Start with the obvious brute force algorithm
> (1) Let S be the union of all the sets
> (2) For each K in 0 .. |S|
This particular task is not a problem about R.
It is a problem n combinatorics.
Start with the obvious brute force algorithm
(1) Let S be the union of all the sets
(2) For each K in 0 .. |S|
(3) Enumerate all |S| choose K subsets C of S
(4) If C satisfies the condition, report it and stop
(5)
It might be easier to implement in R if you employ the base functions
that take arrays and operate on them as if they represented sets. See
the help() for "union", "intersect", "setdiff", "setequal" and the
operator "%in%".
--
Best regards,
Ivan
__
R-h
On December 5, 2019 3:39:07 AM PST, "Александр Дубровский"
wrote:
>Task:
>A family of sets of letters is given. Find K for which one can
>construct a
>set consisting of K letters, each of them belonging to exactly K sets
>of a
>given family.
...
>
> [[alternative HTML version deleted]]
Task:
A family of sets of letters is given. Find K for which one can construct a
set consisting of K letters, each of them belonging to exactly K sets of a
given family.
Possible solution:
For each letter, we will have a separate 'scoop', in which we will' put '
the letter. This can be done using
5 matches
Mail list logo