Skip to content

Commit c0fd315

Browse files
authored
Merge branch 'TheAlgorithms:master' into master
2 parents 8f32300 + 9a572de commit c0fd315

File tree

553 files changed

+3899
-1883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

553 files changed

+3899
-1883
lines changed

.github/CODEOWNERS

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222
# /cellular_automata/
2323

24-
# /ciphers/ @cclauss # TODO: Uncomment this line after Hacktoberfest
24+
# /ciphers/
2525

2626
# /compression/
2727

2828
# /computer_vision/
2929

30-
# /conversions/ @cclauss # TODO: Uncomment this line after Hacktoberfest
30+
# /conversions/
3131

32-
# /data_structures/ @cclauss # TODO: Uncomment this line after Hacktoberfest
32+
# /data_structures/
3333

3434
# /digital_image_processing/
3535

@@ -67,7 +67,7 @@
6767

6868
# /neural_network/
6969

70-
# /other/ @cclauss # TODO: Uncomment this line after Hacktoberfest
70+
# /other/
7171

7272
# /project_euler/
7373

@@ -81,7 +81,7 @@
8181

8282
# /sorts/
8383

84-
# /strings/ @cclauss # TODO: Uncomment this line after Hacktoberfest
84+
# /strings/
8585

8686
# /traversals/
8787

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Keep GitHub Actions up to date with Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"

.github/workflows/build.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,29 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v4
13+
- uses: actions/setup-python@v5
1414
with:
15-
python-version: 3.12
15+
python-version: 3.13
1616
allow-prereleases: true
17-
- uses: actions/cache@v3
17+
- uses: actions/cache@v4
1818
with:
1919
path: ~/.cache/pip
2020
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
2121
- name: Install dependencies
2222
run: |
23-
python -m pip install --upgrade pip setuptools six wheel
23+
python -m pip install --upgrade pip setuptools wheel
2424
python -m pip install pytest-cov -r requirements.txt
2525
- name: Run tests
2626
# TODO: #8818 Re-enable quantum tests
2727
run: pytest
28-
--ignore=quantum/q_fourier_transform.py
29-
--ignore=project_euler/
30-
--ignore=scripts/validate_solutions.py
31-
--cov-report=term-missing:skip-covered
32-
--cov=. .
28+
--ignore=quantum/q_fourier_transform.py
29+
--ignore=computer_vision/cnn_classification.py
30+
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
31+
--ignore=machine_learning/lstm/lstm_prediction.py
32+
--ignore=neural_network/input_data.py
33+
--ignore=project_euler/
34+
--ignore=scripts/validate_solutions.py
35+
--cov-report=term-missing:skip-covered
36+
--cov=. .
3337
- if: ${{ success() }}
3438
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

.github/workflows/directory_writer.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ jobs:
99
- uses: actions/checkout@v4
1010
with:
1111
fetch-depth: 0
12-
- uses: actions/setup-python@v4
12+
- uses: actions/setup-python@v5
1313
with:
1414
python-version: 3.x
1515
- name: Write DIRECTORY.md
1616
run: |
1717
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
18-
git config --global user.name github-actions
19-
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
18+
git config --global user.name "$GITHUB_ACTOR"
19+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
2020
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
2121
- name: Update DIRECTORY.md
2222
run: |

.github/workflows/project_euler.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- uses: actions/setup-python@v4
18+
- uses: actions/setup-python@v5
1919
with:
2020
python-version: 3.x
2121
- name: Install pytest and pytest-cov
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- uses: actions/checkout@v4
30-
- uses: actions/setup-python@v4
30+
- uses: actions/setup-python@v5
3131
with:
3232
python-version: 3.x
3333
- name: Install pytest and requests

.github/workflows/ruff.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
ruff:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
15-
- run: pip install --user ruff
16-
- run: ruff --output-format=github .
14+
- uses: actions/checkout@v4
15+
- run: pip install --user ruff
16+
- run: ruff check --output-format=github .

.pre-commit-config.yaml

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-executables-have-shebangs
66
- id: check-toml
@@ -11,29 +11,25 @@ repos:
1111
- id: requirements-txt-fixer
1212

1313
- repo: https://github.com/MarcoGorelli/auto-walrus
14-
rev: v0.2.2
14+
rev: 0.3.4
1515
hooks:
16-
- id: auto-walrus
16+
- id: auto-walrus
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.1.6
19+
rev: v0.6.8
2020
hooks:
2121
- id: ruff
22-
23-
- repo: https://github.com/psf/black
24-
rev: 23.11.0
25-
hooks:
26-
- id: black
22+
- id: ruff-format
2723

2824
- repo: https://github.com/codespell-project/codespell
29-
rev: v2.2.6
25+
rev: v2.3.0
3026
hooks:
3127
- id: codespell
3228
additional_dependencies:
3329
- tomli
3430

3531
- repo: https://github.com/tox-dev/pyproject-fmt
36-
rev: "1.5.3"
32+
rev: "2.2.4"
3733
hooks:
3834
- id: pyproject-fmt
3935

@@ -46,16 +42,23 @@ repos:
4642
pass_filenames: false
4743

4844
- repo: https://github.com/abravalheri/validate-pyproject
49-
rev: v0.15
45+
rev: v0.20.2
5046
hooks:
5147
- id: validate-pyproject
5248

5349
- repo: https://github.com/pre-commit/mirrors-mypy
54-
rev: v1.7.1
50+
rev: v1.11.2
5551
hooks:
5652
- id: mypy
5753
args:
54+
- --explicit-package-bases
5855
- --ignore-missing-imports
5956
- --install-types # See mirrors-mypy README.md
6057
- --non-interactive
6158
additional_dependencies: [types-requests]
59+
60+
- repo: https://github.com/pre-commit/mirrors-prettier
61+
rev: "v4.0.0-alpha.8"
62+
hooks:
63+
- id: prettier
64+
types_or: [toml, yaml]

DIRECTORY.md

+32-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* [Rat In Maze](backtracking/rat_in_maze.py)
2323
* [Sudoku](backtracking/sudoku.py)
2424
* [Sum Of Subsets](backtracking/sum_of_subsets.py)
25+
* [Word Ladder](backtracking/word_ladder.py)
2526
* [Word Search](backtracking/word_search.py)
2627

2728
## Bit Manipulation
@@ -134,6 +135,7 @@
134135
* [Run Length Encoding](compression/run_length_encoding.py)
135136

136137
## Computer Vision
138+
* [Cnn Classification](computer_vision/cnn_classification.py)
137139
* [Flip Augmentation](computer_vision/flip_augmentation.py)
138140
* [Haralick Descriptors](computer_vision/haralick_descriptors.py)
139141
* [Harris Corner](computer_vision/harris_corner.py)
@@ -242,6 +244,15 @@
242244
* [Min Heap](data_structures/heap/min_heap.py)
243245
* [Randomized Heap](data_structures/heap/randomized_heap.py)
244246
* [Skew Heap](data_structures/heap/skew_heap.py)
247+
* Kd Tree
248+
* [Build Kdtree](data_structures/kd_tree/build_kdtree.py)
249+
* Example
250+
* [Example Usage](data_structures/kd_tree/example/example_usage.py)
251+
* [Hypercube Points](data_structures/kd_tree/example/hypercube_points.py)
252+
* [Kd Node](data_structures/kd_tree/kd_node.py)
253+
* [Nearest Neighbour Search](data_structures/kd_tree/nearest_neighbour_search.py)
254+
* Tests
255+
* [Test Kdtree](data_structures/kd_tree/tests/test_kdtree.py)
245256
* Linked List
246257
* [Circular Linked List](data_structures/linked_list/circular_linked_list.py)
247258
* [Deque Doubly](data_structures/linked_list/deque_doubly.py)
@@ -281,6 +292,13 @@
281292
* [Stack With Doubly Linked List](data_structures/stacks/stack_with_doubly_linked_list.py)
282293
* [Stack With Singly Linked List](data_structures/stacks/stack_with_singly_linked_list.py)
283294
* [Stock Span Problem](data_structures/stacks/stock_span_problem.py)
295+
* Suffix Tree
296+
* Example
297+
* [Example Usage](data_structures/suffix_tree/example/example_usage.py)
298+
* [Suffix Tree](data_structures/suffix_tree/suffix_tree.py)
299+
* [Suffix Tree Node](data_structures/suffix_tree/suffix_tree_node.py)
300+
* Tests
301+
* [Test Suffix Tree](data_structures/suffix_tree/tests/test_suffix_tree.py)
284302
* Trie
285303
* [Radix Tree](data_structures/trie/radix_tree.py)
286304
* [Trie](data_structures/trie/trie.py)
@@ -344,12 +362,13 @@
344362
* [Floyd Warshall](dynamic_programming/floyd_warshall.py)
345363
* [Integer Partition](dynamic_programming/integer_partition.py)
346364
* [Iterating Through Submasks](dynamic_programming/iterating_through_submasks.py)
365+
* [K Means Clustering Tensorflow](dynamic_programming/k_means_clustering_tensorflow.py)
347366
* [Knapsack](dynamic_programming/knapsack.py)
348367
* [Largest Divisible Subset](dynamic_programming/largest_divisible_subset.py)
349368
* [Longest Common Subsequence](dynamic_programming/longest_common_subsequence.py)
350369
* [Longest Common Substring](dynamic_programming/longest_common_substring.py)
351370
* [Longest Increasing Subsequence](dynamic_programming/longest_increasing_subsequence.py)
352-
* [Longest Increasing Subsequence O(Nlogn)](dynamic_programming/longest_increasing_subsequence_o(nlogn).py)
371+
* [Longest Increasing Subsequence O Nlogn](dynamic_programming/longest_increasing_subsequence_o_nlogn.py)
353372
* [Longest Palindromic Subsequence](dynamic_programming/longest_palindromic_subsequence.py)
354373
* [Matrix Chain Multiplication](dynamic_programming/matrix_chain_multiplication.py)
355374
* [Matrix Chain Order](dynamic_programming/matrix_chain_order.py)
@@ -417,6 +436,7 @@
417436
* [Koch Snowflake](fractals/koch_snowflake.py)
418437
* [Mandelbrot](fractals/mandelbrot.py)
419438
* [Sierpinski Triangle](fractals/sierpinski_triangle.py)
439+
* [Vicsek](fractals/vicsek.py)
420440

421441
## Fuzzy Logic
422442
* [Fuzzy Operations](fuzzy_logic/fuzzy_operations.py)
@@ -462,7 +482,7 @@
462482
* [Dijkstra Alternate](graphs/dijkstra_alternate.py)
463483
* [Dijkstra Binary Grid](graphs/dijkstra_binary_grid.py)
464484
* [Dinic](graphs/dinic.py)
465-
* [Directed And Undirected (Weighted) Graph](graphs/directed_and_undirected_(weighted)_graph.py)
485+
* [Directed And Undirected Weighted Graph](graphs/directed_and_undirected_weighted_graph.py)
466486
* [Edmonds Karp Multiple Source And Sink](graphs/edmonds_karp_multiple_source_and_sink.py)
467487
* [Eulerian Path And Circuit For Undirected Graph](graphs/eulerian_path_and_circuit_for_undirected_graph.py)
468488
* [Even Tree](graphs/even_tree.py)
@@ -537,8 +557,7 @@
537557
* [Lu Decomposition](linear_algebra/lu_decomposition.py)
538558
* Src
539559
* [Conjugate Gradient](linear_algebra/src/conjugate_gradient.py)
540-
* Gaussian Elimination Pivoting
541-
* [Gaussian Elimination Pivoting](linear_algebra/src/gaussian_elimination_pivoting/gaussian_elimination_pivoting.py)
560+
* [Gaussian Elimination Pivoting](linear_algebra/src/gaussian_elimination_pivoting.py)
542561
* [Lib](linear_algebra/src/lib.py)
543562
* [Polynom For Points](linear_algebra/src/polynom_for_points.py)
544563
* [Power Iteration](linear_algebra/src/power_iteration.py)
@@ -571,6 +590,8 @@
571590
* [Local Weighted Learning](machine_learning/local_weighted_learning/local_weighted_learning.py)
572591
* [Logistic Regression](machine_learning/logistic_regression.py)
573592
* [Loss Functions](machine_learning/loss_functions.py)
593+
* Lstm
594+
* [Lstm Prediction](machine_learning/lstm/lstm_prediction.py)
574595
* [Mfcc](machine_learning/mfcc.py)
575596
* [Multilayer Perceptron Classifier](machine_learning/multilayer_perceptron_classifier.py)
576597
* [Polynomial Regression](machine_learning/polynomial_regression.py)
@@ -631,7 +652,6 @@
631652
* [Floor](maths/floor.py)
632653
* [Gamma](maths/gamma.py)
633654
* [Gaussian](maths/gaussian.py)
634-
* [Gaussian Error Linear Unit](maths/gaussian_error_linear_unit.py)
635655
* [Gcd Of N Numbers](maths/gcd_of_n_numbers.py)
636656
* [Germain Primes](maths/germain_primes.py)
637657
* [Greatest Common Divisor](maths/greatest_common_divisor.py)
@@ -657,7 +677,6 @@
657677
* [Manhattan Distance](maths/manhattan_distance.py)
658678
* [Matrix Exponentiation](maths/matrix_exponentiation.py)
659679
* [Max Sum Sliding Window](maths/max_sum_sliding_window.py)
660-
* [Median Of Two Arrays](maths/median_of_two_arrays.py)
661680
* [Minkowski Distance](maths/minkowski_distance.py)
662681
* [Mobius Function](maths/mobius_function.py)
663682
* [Modular Division](maths/modular_division.py)
@@ -675,6 +694,7 @@
675694
* [Newton Forward Interpolation](maths/numerical_analysis/newton_forward_interpolation.py)
676695
* [Newton Raphson](maths/numerical_analysis/newton_raphson.py)
677696
* [Numerical Integration](maths/numerical_analysis/numerical_integration.py)
697+
* [Proper Fractions](maths/numerical_analysis/proper_fractions.py)
678698
* [Runge Kutta](maths/numerical_analysis/runge_kutta.py)
679699
* [Runge Kutta Fehlberg 45](maths/numerical_analysis/runge_kutta_fehlberg_45.py)
680700
* [Runge Kutta Gills](maths/numerical_analysis/runge_kutta_gills.py)
@@ -768,6 +788,7 @@
768788
* [Inverse Of Matrix](matrix/inverse_of_matrix.py)
769789
* [Largest Square Area In Matrix](matrix/largest_square_area_in_matrix.py)
770790
* [Matrix Class](matrix/matrix_class.py)
791+
* [Matrix Equalization](matrix/matrix_equalization.py)
771792
* [Matrix Multiplication Recursion](matrix/matrix_multiplication_recursion.py)
772793
* [Matrix Operation](matrix/matrix_operation.py)
773794
* [Max Area Of Island](matrix/max_area_of_island.py)
@@ -787,10 +808,10 @@
787808
* [Minimum Cut](networking_flow/minimum_cut.py)
788809

789810
## Neural Network
790-
* [2 Hidden Layers Neural Network](neural_network/2_hidden_layers_neural_network.py)
791811
* Activation Functions
792812
* [Binary Step](neural_network/activation_functions/binary_step.py)
793813
* [Exponential Linear Unit](neural_network/activation_functions/exponential_linear_unit.py)
814+
* [Gaussian Error Linear Unit](neural_network/activation_functions/gaussian_error_linear_unit.py)
794815
* [Leaky Rectified Linear Unit](neural_network/activation_functions/leaky_rectified_linear_unit.py)
795816
* [Mish](neural_network/activation_functions/mish.py)
796817
* [Rectified Linear Unit](neural_network/activation_functions/rectified_linear_unit.py)
@@ -801,7 +822,9 @@
801822
* [Swish](neural_network/activation_functions/swish.py)
802823
* [Back Propagation Neural Network](neural_network/back_propagation_neural_network.py)
803824
* [Convolution Neural Network](neural_network/convolution_neural_network.py)
825+
* [Input Data](neural_network/input_data.py)
804826
* [Simple Neural Network](neural_network/simple_neural_network.py)
827+
* [Two Hidden Layers Neural Network](neural_network/two_hidden_layers_neural_network.py)
805828

806829
## Other
807830
* [Activity Selection](other/activity_selection.py)
@@ -856,6 +879,7 @@
856879
* [Newtons Second Law Of Motion](physics/newtons_second_law_of_motion.py)
857880
* [Photoelectric Effect](physics/photoelectric_effect.py)
858881
* [Potential Energy](physics/potential_energy.py)
882+
* [Rainfall Intensity](physics/rainfall_intensity.py)
859883
* [Reynolds Number](physics/reynolds_number.py)
860884
* [Rms Speed Of Molecule](physics/rms_speed_of_molecule.py)
861885
* [Shear Stress](physics/shear_stress.py)
@@ -1252,6 +1276,7 @@
12521276
* [Can String Be Rearranged As Palindrome](strings/can_string_be_rearranged_as_palindrome.py)
12531277
* [Capitalize](strings/capitalize.py)
12541278
* [Check Anagrams](strings/check_anagrams.py)
1279+
* [Count Vowels](strings/count_vowels.py)
12551280
* [Credit Card Validator](strings/credit_card_validator.py)
12561281
* [Damerau Levenshtein Distance](strings/damerau_levenshtein_distance.py)
12571282
* [Detecting English Programmatically](strings/detecting_english_programmatically.py)
@@ -1319,7 +1344,6 @@
13191344
* [Get Ip Geolocation](web_programming/get_ip_geolocation.py)
13201345
* [Get Top Billionaires](web_programming/get_top_billionaires.py)
13211346
* [Get Top Hn Posts](web_programming/get_top_hn_posts.py)
1322-
* [Get User Tweets](web_programming/get_user_tweets.py)
13231347
* [Giphy](web_programming/giphy.py)
13241348
* [Instagram Crawler](web_programming/instagram_crawler.py)
13251349
* [Instagram Pic](web_programming/instagram_pic.py)

0 commit comments

Comments
 (0)