LINUX.ORG.RU

История изменений

Исправление qulinxao, (текущая версия) :

pod is positions of delimeters :)

seq is 0,1,2,3,4,n

pos on right so last delim after n. so pos in [0..n] to

gen_all_pods(n):
        gen(0,n,[])

gen(l,r,o):
        if l>r:
                out(o);
                return;
        for p in [l..r]:
                gen(p+1,r,o+[p])

Исходная версия qulinxao, :

pod is positions of delimeters :)

seq is 0,1,2,3,4,n

pos on right so last delim after n. so pos in [0..n] to

gen_all_pods(n):
        gen(0,n,[])

gen(l,r,o):
        if l>r:
                out(o);
                return;
        for p in [l..n]:
                gen(p+1,n,o+[p])