Skip to content

Commit 58e12b0

Browse files
committed
docs: add docstring and doctests to generate_all_permutations)
1 parent f5988cc commit 58e12b0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

backtracking/all_permutations.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010

1111

1212
def generate_all_permutations(sequence: list[int | str]) -> None:
13+
"""
14+
Generate and print all possible permutations of the given sequence.
15+
16+
>>> generate_all_permutations([1, 2])
17+
[1, 2]
18+
[2, 1]
19+
>>> generate_all_permutations(["A", "B"])
20+
['A', 'B']
21+
['B', 'A']
22+
"""
1323
create_state_space_tree(sequence, [], 0, [0 for i in range(len(sequence))])
1424

1525

0 commit comments

Comments
 (0)