by Gustavo Niemeyer
Another snippet to compute the permutations of all subsets.
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
I’ve just posted an entry showing how to do that, and how many outputs it yields.
Thanks for asking!
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
Name (required)
Mail (will not be published) (required)
Website
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
I’ve just posted an entry showing how to do that, and how many outputs it yields.
Thanks for asking!
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