Permutations of all subsets

Another snippet to compute the permutations of all subsets.

This entry was posted in Math, Python, Snippet. Bookmark the permalink.

3 Responses to Permutations of all subsets

  1. I’ve just posted an entry showing how to do that, and how many outputs it yields.

    Thanks for asking!

  2. Anonymous says:

    i really like these permutation algorithms because I have no idea how they work and that’s the fun :)

    i am actually looking for an algorithm, which would give me all possible combination for a list of chars.

    say I have: a list l = [‘a’,’b’,’c’]
    when you set a border of 3, it wil generate the following

    a
    b
    c
    aa
    ab
    ac
    ba
    bb
    bc
    ca
    cb
    cc
    aaa
    aab
    until ‘ccc’

    etcetera

  3. M. Kara says:

    I need an algorithm like this:

    For a given integer n, find all integer subsets s1, s2, …, sk where sum(s1) = n, sum(s2) = n etc.

    For example, for n = 5

    s1 = {5}
    s2 = {4, 1}
    s3 = {3, 2}
    .
    .
    .
    sk = {1, 1, 1, 1, 1}

    Thanks in advance…

    M. Kara

Leave a Reply

Your email address will not be published. Required fields are marked *