mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Add static typing to backtracking algorithms (#2684)
* Added static typing to backtracking algorithms * Ran psf/black to fix some minor issues. * updating DIRECTORY.md * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
@ -7,11 +7,13 @@
|
||||
"""
|
||||
|
||||
|
||||
def generate_all_permutations(sequence):
|
||||
def generate_all_permutations(sequence: [int]) -> None:
|
||||
create_state_space_tree(sequence, [], 0, [0 for i in range(len(sequence))])
|
||||
|
||||
|
||||
def create_state_space_tree(sequence, current_sequence, index, index_used):
|
||||
def create_state_space_tree(
|
||||
sequence: [int], current_sequence: [int], index: int, index_used: int
|
||||
) -> None:
|
||||
"""
|
||||
Creates a state space tree to iterate through each branch using DFS.
|
||||
We know that each state has exactly len(sequence) - index children.
|
||||
|
Reference in New Issue
Block a user