Skip to content

Commit 8bd4ca6

Browse files
ruppysuppygithub-actions
and
github-actions
authored
Added all sub sequence type hints [Hacktober Fest] (TheAlgorithms#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>
1 parent 927e14e commit 8bd4ca6

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

DIRECTORY.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@
473473
* [Binary Exponentiation 2](https://github.com/TheAlgorithms/Python/blob/master/other/binary_exponentiation_2.py)
474474
* [Detecting English Programmatically](https://github.com/TheAlgorithms/Python/blob/master/other/detecting_english_programmatically.py)
475475
* [Dijkstra Bankers Algorithm](https://github.com/TheAlgorithms/Python/blob/master/other/dijkstra_bankers_algorithm.py)
476+
* [Doomsday](https://github.com/TheAlgorithms/Python/blob/master/other/doomsday.py)
476477
* [Euclidean Gcd](https://github.com/TheAlgorithms/Python/blob/master/other/euclidean_gcd.py)
477478
* [Fischer Yates Shuffle](https://github.com/TheAlgorithms/Python/blob/master/other/fischer_yates_shuffle.py)
478479
* [Frequency Finder](https://github.com/TheAlgorithms/Python/blob/master/other/frequency_finder.py)
@@ -487,6 +488,7 @@
487488
* [Lru Cache](https://github.com/TheAlgorithms/Python/blob/master/other/lru_cache.py)
488489
* [Magicdiamondpattern](https://github.com/TheAlgorithms/Python/blob/master/other/magicdiamondpattern.py)
489490
* [Markov Chain](https://github.com/TheAlgorithms/Python/blob/master/other/markov_chain.py)
491+
* [Max Sum Sliding Window](https://github.com/TheAlgorithms/Python/blob/master/other/max_sum_sliding_window.py)
490492
* [Nested Brackets](https://github.com/TheAlgorithms/Python/blob/master/other/nested_brackets.py)
491493
* [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/other/palindrome.py)
492494
* [Password Generator](https://github.com/TheAlgorithms/Python/blob/master/other/password_generator.py)
@@ -529,7 +531,6 @@
529531
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_06/sol2.py)
530532
* [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_06/sol3.py)
531533
* [Sol4](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_06/sol4.py)
532-
* [Test Solutions](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_06/test_solutions.py)
533534
* Problem 07
534535
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_07/sol1.py)
535536
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_07/sol2.py)
@@ -595,11 +596,11 @@
595596
* Problem 26
596597
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_26/sol1.py)
597598
* Problem 27
598-
* [Problem 27 Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_27/problem_27_sol1.py)
599+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_27/sol1.py)
599600
* Problem 28
600601
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_28/sol1.py)
601602
* Problem 29
602-
* [Solution](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_29/solution.py)
603+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_29/sol1.py)
603604
* Problem 30
604605
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_30/sol1.py)
605606
* Problem 31
@@ -656,6 +657,8 @@
656657
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_63/sol1.py)
657658
* Problem 67
658659
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_67/sol1.py)
660+
* Problem 71
661+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_71/sol1.py)
659662
* Problem 76
660663
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_76/sol1.py)
661664
* Problem 97

backtracking/all_subsequences.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Any, List
2+
13
"""
24
In this problem, we want to determine all possible subsequences
35
of the given sequence. We use backtracking to solve this problem.
@@ -7,11 +9,13 @@
79
"""
810

911

10-
def generate_all_subsequences(sequence):
12+
def generate_all_subsequences(sequence: List[Any]) -> None:
1113
create_state_space_tree(sequence, [], 0)
1214

1315

14-
def create_state_space_tree(sequence, current_subsequence, index):
16+
def create_state_space_tree(
17+
sequence: List[Any], current_subsequence: List[Any], index: int
18+
) -> None:
1519
"""
1620
Creates a state space tree to iterate through each branch using DFS.
1721
We know that each state has exactly two children.

0 commit comments

Comments
 (0)