U
U
UNdedss2014-10-06 18:22:32
Programming
UNdedss, 2014-10-06 18:22:32

How to implement iteration of random subsets?

Tell me how you can choose random subsets in an iterator, but with the condition of a guarantee of non-repeatability.
Those. so that when you receive the next subset, you do not have to check the fact of its previous use.
There are thoughts to use Gray codes - choose one of the code classes and generate binary numbers according to it.
UPD:
The task is to be able to enumerate ALL subsets of a given set (large enough). At the same time, get the next subset in the form:

class subsetSource<T>
{
    public List<T> getNewSubset()
    {
        ...
        return ....
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2014-10-06
@UNdedss

Iterate over the subset numbers in order, apply a bijective transformation to the numbers (for example, a block cipher) in order to obtain its elements from the subset serial number.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question