Created
August 31, 2011 05:12
-
-
Save mharju/1182864 to your computer and use it in GitHub Desktop.
Etsii ne lähtöjoukon n/2-kombinaatiot, joiden unioni muodostaa koko lähtöjoukon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_bipartitioning_combinations(iterable): | |
return ( (i, j) for i in itertools.permutations(iterable, len(iterable) / 2) | |
for j in itertools.permutations(iterable, len(iterable) / 2) | |
if set(i).union(j) == set(iterable) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment