mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Added all sub sequence type hints [Hacktober Fest] (#3123)
* updating DIRECTORY.md
* chore(all-subsequence): added type hints [HACKTOBER-FEST]
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from typing import Any, List
|
||||
|
||||
"""
|
||||
In this problem, we want to determine all possible subsequences
|
||||
of the given sequence. We use backtracking to solve this problem.
|
||||
@@ -7,11 +9,13 @@
|
||||
"""
|
||||
|
||||
|
||||
def generate_all_subsequences(sequence):
|
||||
def generate_all_subsequences(sequence: List[Any]) -> None:
|
||||
create_state_space_tree(sequence, [], 0)
|
||||
|
||||
|
||||
def create_state_space_tree(sequence, current_subsequence, index):
|
||||
def create_state_space_tree(
|
||||
sequence: List[Any], current_subsequence: List[Any], index: int
|
||||
) -> None:
|
||||
"""
|
||||
Creates a state space tree to iterate through each branch using DFS.
|
||||
We know that each state has exactly two children.
|
||||
|
||||
Reference in New Issue
Block a user