| | |
| | | import sys |
| | | |
| | | n = int(sys.argv[1]) |
| | | |
| | | # permutations = [[0]] |
| | | # element = 1 |
| | | # n = 2 |
| | | # |
| | | # next_permutations = [] |
| | | # for p in permutations: |
| | | # for position in range(0, len(p) + 1): |
| | | # new_permutation = p.copy() |
| | | # new_permutation.insert(position, element) |
| | | # next_permutations.append(new_permutation) |
| | | # print(next_permutations) |
| | | """ |
| | | function permutation(set: []) -> [] |
| | | if size(set) < 2 return [set]; |
| | | result = [] |
| | | for idx, e in set: |
| | | other_elements = set \ {e} |
| | | other_permutations = permutation(other_elements) |
| | | for p in other_permutations: |
| | | result.append( [e].concat(p) ) |
| | | end |
| | | end |
| | | return result |
| | | end |
| | | """ |
| | | |
| | | permutations = [[]] |
| | | element = n - 1 |