Skip to content

Commit 66207b8

Browse files
authored
Merge branch 'master' into feat/minimum-absolute-difference-pairs
2 parents e2abc42 + 791deb4 commit 66207b8

115 files changed

Lines changed: 2696 additions & 426 deletions

File tree

Some content is hidden

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

β€Ž.github/workflows/build.ymlβ€Ž

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,25 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v5
13-
- uses: astral-sh/setup-uv@v6
12+
- run: sudo apt-get update && sudo apt-get install -y libhdf5-dev
13+
- uses: actions/checkout@v6
14+
- uses: astral-sh/setup-uv@v7
1415
with:
1516
enable-cache: true
1617
cache-dependency-glob: uv.lock
17-
- uses: actions/setup-python@v5
18+
- uses: actions/setup-python@v6
1819
with:
19-
python-version: 3.x
20+
python-version: 3.14
2021
allow-prereleases: true
2122
- run: uv sync --group=test
2223
- name: Run tests
2324
# TODO: #8818 Re-enable quantum tests
24-
run: uv run pytest
25+
run: uv run --with=pytest-run-parallel pytest
26+
--iterations=8 --parallel-threads=auto
2527
--ignore=computer_vision/cnn_classification.py
2628
--ignore=docs/conf.py
2729
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
30+
--ignore=machine_learning/local_weighted_learning/local_weighted_learning.py
2831
--ignore=machine_learning/lstm/lstm_prediction.py
2932
--ignore=neural_network/input_data.py
3033
--ignore=project_euler/

β€Ž.github/workflows/devcontainer_ci.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1616
- uses: devcontainers/ci@v0.3
1717
with:
1818
push: never

β€Ž.github/workflows/directory_writer.ymlβ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ jobs:
66
directory_writer:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v5
9+
- uses: actions/checkout@v6
1010
with:
1111
fetch-depth: 0
12-
- uses: actions/setup-python@v5
12+
- uses: actions/setup-python@v6
1313
with:
14-
python-version: 3.x
14+
python-version: 3.14
15+
allow-prereleases: true
1516
- name: Write DIRECTORY.md
1617
run: |
1718
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

β€Ž.github/workflows/project_euler.ymlβ€Ž

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,37 @@ jobs:
1414
project-euler:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v5
18-
- uses: astral-sh/setup-uv@v6
19-
- uses: actions/setup-python@v5
17+
- run:
18+
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
19+
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
20+
libharfbuzz-dev libfribidi-dev libxcb1-dev
21+
libxml2-dev libxslt-dev
22+
libhdf5-dev
23+
libopenblas-dev
24+
- uses: actions/checkout@v6
25+
- uses: astral-sh/setup-uv@v7
26+
- uses: actions/setup-python@v6
2027
with:
21-
python-version: 3.x
28+
python-version: 3.14
29+
allow-prereleases: true
2230
- run: uv sync --group=euler-validate --group=test
2331
- run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
2432
validate-solutions:
2533
runs-on: ubuntu-latest
2634
steps:
27-
- uses: actions/checkout@v5
28-
- uses: astral-sh/setup-uv@v6
29-
- uses: actions/setup-python@v5
35+
- run:
36+
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
37+
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
38+
libharfbuzz-dev libfribidi-dev libxcb1-dev
39+
libxml2-dev libxslt-dev
40+
libhdf5-dev
41+
libopenblas-dev
42+
- uses: actions/checkout@v6
43+
- uses: astral-sh/setup-uv@v7
44+
- uses: actions/setup-python@v6
3045
with:
31-
python-version: 3.x
46+
python-version: 3.14
47+
allow-prereleases: true
3248
- run: uv sync --group=euler-validate --group=test
3349
- run: uv run pytest scripts/validate_solutions.py
3450
env:

β€Ž.github/workflows/ruff.ymlβ€Ž

Lines changed: 2 additions & 2 deletions
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@v5
15-
- uses: astral-sh/setup-uv@v6
14+
- uses: actions/checkout@v6
15+
- uses: astral-sh/setup-uv@v7
1616
- run: uvx ruff check --output-format=github .

β€Ž.github/workflows/sphinx.ymlβ€Ž

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,23 @@ jobs:
2525
build_docs:
2626
runs-on: ubuntu-24.04-arm
2727
steps:
28-
- uses: actions/checkout@v5
29-
- uses: astral-sh/setup-uv@v6
30-
- uses: actions/setup-python@v5
28+
- run:
29+
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
30+
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
31+
libharfbuzz-dev libfribidi-dev libxcb1-dev
32+
libxml2-dev libxslt-dev
33+
libhdf5-dev
34+
libopenblas-dev
35+
- uses: actions/checkout@v6
36+
- uses: astral-sh/setup-uv@v7
37+
- uses: actions/setup-python@v6
3138
with:
32-
python-version: 3.13
39+
python-version: 3.14
3340
allow-prereleases: true
3441
- run: uv sync --group=docs
35-
- uses: actions/configure-pages@v5
42+
- uses: actions/configure-pages@v6
3643
- run: uv run sphinx-build -c docs . docs/_build/html
37-
- uses: actions/upload-pages-artifact@v4
44+
- uses: actions/upload-pages-artifact@v5
3845
with:
3946
path: docs/_build/html
4047

@@ -46,5 +53,5 @@ jobs:
4653
needs: build_docs
4754
runs-on: ubuntu-latest
4855
steps:
49-
- uses: actions/deploy-pages@v4
56+
- uses: actions/deploy-pages@v5
5057
id: deployment

β€Ž.pre-commit-config.yamlβ€Ž

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ci:
2+
autoupdate_schedule: monthly
3+
14
repos:
25
- repo: https://github.com/pre-commit/pre-commit-hooks
36
rev: v6.0.0
@@ -11,25 +14,25 @@ repos:
1114
- id: requirements-txt-fixer
1215

1316
- repo: https://github.com/MarcoGorelli/auto-walrus
14-
rev: 0.3.4
17+
rev: 0.4.1
1518
hooks:
1619
- id: auto-walrus
1720

1821
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.12.9
22+
rev: v0.15.9
2023
hooks:
2124
- id: ruff-check
2225
- id: ruff-format
2326

2427
- repo: https://github.com/codespell-project/codespell
25-
rev: v2.4.1
28+
rev: v2.4.2
2629
hooks:
2730
- id: codespell
2831
additional_dependencies:
2932
- tomli
3033

3134
- repo: https://github.com/tox-dev/pyproject-fmt
32-
rev: v2.6.0
35+
rev: v2.21.0
3336
hooks:
3437
- id: pyproject-fmt
3538

@@ -42,19 +45,19 @@ repos:
4245
pass_filenames: false
4346

4447
- repo: https://github.com/abravalheri/validate-pyproject
45-
rev: v0.24.1
48+
rev: v0.25
4649
hooks:
4750
- id: validate-pyproject
4851

49-
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: v1.15.0
51-
hooks:
52-
- id: mypy
53-
args:
54-
- --explicit-package-bases
55-
- --ignore-missing-imports
56-
- --install-types
57-
- --non-interactive
52+
# - repo: https://github.com/pre-commit/mirrors-mypy
53+
# rev: v1.20.0
54+
# hooks:
55+
# - id: mypy
56+
# args:
57+
# - --explicit-package-bases
58+
# - --ignore-missing-imports
59+
# - --install-types
60+
# - --non-interactive
5861

5962
- repo: https://github.com/pre-commit/mirrors-prettier
6063
rev: v4.0.0-alpha.8

β€ŽCONTRIBUTING.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ We want your work to be readable by others; therefore, we encourage you to note
9999
ruff check
100100
```
101101

102-
- Original code submission require docstrings or comments to describe your work.
102+
- Original code submissions require docstrings or comments to describe your work.
103103

104104
- More on docstrings and comments:
105105

@@ -159,7 +159,7 @@ We want your work to be readable by others; therefore, we encourage you to note
159159
starting_value = int(input("Please enter a starting value: ").strip())
160160
```
161161

162-
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](http://mypy-lang.org) so run that locally before making your submission.
162+
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](https://mypy-lang.org) so run that locally before making your submission.
163163

164164
```python
165165
def sum_ab(a: int, b: int) -> int:

β€ŽDIRECTORY.mdβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [Combination Sum](backtracking/combination_sum.py)
1313
* [Crossword Puzzle Solver](backtracking/crossword_puzzle_solver.py)
1414
* [Generate Parentheses](backtracking/generate_parentheses.py)
15+
* [Generate Parentheses Iterative](backtracking/generate_parentheses_iterative.py)
1516
* [Hamiltonian Cycle](backtracking/hamiltonian_cycle.py)
1617
* [Knight Tour](backtracking/knight_tour.py)
1718
* [Match Word Pattern](backtracking/match_word_pattern.py)
@@ -174,6 +175,7 @@
174175

175176
## Data Compression
176177
* [Burrows Wheeler](data_compression/burrows_wheeler.py)
178+
* [Coordinate Compression](data_compression/coordinate_compression.py)
177179
* [Huffman](data_compression/huffman.py)
178180
* [Lempel Ziv](data_compression/lempel_ziv.py)
179181
* [Lempel Ziv Decompress](data_compression/lempel_ziv_decompress.py)
@@ -193,6 +195,7 @@
193195
* [Permutations](data_structures/arrays/permutations.py)
194196
* [Prefix Sum](data_structures/arrays/prefix_sum.py)
195197
* [Product Sum](data_structures/arrays/product_sum.py)
198+
* [Rotate Array](data_structures/arrays/rotate_array.py)
196199
* [Sparse Table](data_structures/arrays/sparse_table.py)
197200
* [Sudoku Solver](data_structures/arrays/sudoku_solver.py)
198201
* Binary Tree
@@ -395,6 +398,7 @@
395398
* [Minimum Squares To Represent A Number](dynamic_programming/minimum_squares_to_represent_a_number.py)
396399
* [Minimum Steps To One](dynamic_programming/minimum_steps_to_one.py)
397400
* [Minimum Tickets Cost](dynamic_programming/minimum_tickets_cost.py)
401+
* [Narcissistic Number](dynamic_programming/narcissistic_number.py)
398402
* [Optimal Binary Search Tree](dynamic_programming/optimal_binary_search_tree.py)
399403
* [Palindrome Partitioning](dynamic_programming/palindrome_partitioning.py)
400404
* [Range Sum Query](dynamic_programming/range_sum_query.py)
@@ -465,6 +469,11 @@
465469

466470
## Geometry
467471
* [Geometry](geometry/geometry.py)
472+
* [Graham Scan](geometry/graham_scan.py)
473+
* [Jarvis March](geometry/jarvis_march.py)
474+
* Tests
475+
* [Test Graham Scan](geometry/tests/test_graham_scan.py)
476+
* [Test Jarvis March](geometry/tests/test_jarvis_march.py)
468477

469478
## Graphics
470479
* [Bezier Curve](graphics/bezier_curve.py)
@@ -621,6 +630,7 @@
621630
* [Sequential Minimum Optimization](machine_learning/sequential_minimum_optimization.py)
622631
* [Similarity Search](machine_learning/similarity_search.py)
623632
* [Support Vector Machines](machine_learning/support_vector_machines.py)
633+
* [T Stochastic Neighbour Embedding](machine_learning/t_stochastic_neighbour_embedding.py)
624634
* [Word Frequency Functions](machine_learning/word_frequency_functions.py)
625635
* [Xgboost Classifier](machine_learning/xgboost_classifier.py)
626636
* [Xgboost Regressor](machine_learning/xgboost_regressor.py)
@@ -723,6 +733,7 @@
723733
* [Secant Method](maths/numerical_analysis/secant_method.py)
724734
* [Simpson Rule](maths/numerical_analysis/simpson_rule.py)
725735
* [Square Root](maths/numerical_analysis/square_root.py)
736+
* [Weierstrass Method](maths/numerical_analysis/weierstrass_method.py)
726737
* [Odd Sieve](maths/odd_sieve.py)
727738
* [Perfect Cube](maths/perfect_cube.py)
728739
* [Perfect Number](maths/perfect_number.py)
@@ -875,6 +886,7 @@
875886
* [Quine](other/quine.py)
876887
* [Scoring Algorithm](other/scoring_algorithm.py)
877888
* [Sdes](other/sdes.py)
889+
* [Sliding Window Maximum](other/sliding_window_maximum.py)
878890
* [Tower Of Hanoi](other/tower_of_hanoi.py)
879891
* [Word Search](other/word_search.py)
880892

@@ -956,6 +968,7 @@
956968
* [Sol1](project_euler/problem_009/sol1.py)
957969
* [Sol2](project_euler/problem_009/sol2.py)
958970
* [Sol3](project_euler/problem_009/sol3.py)
971+
* [Sol4](project_euler/problem_009/sol4.py)
959972
* Problem 010
960973
* [Sol1](project_euler/problem_010/sol1.py)
961974
* [Sol2](project_euler/problem_010/sol2.py)
@@ -973,6 +986,7 @@
973986
* [Sol2](project_euler/problem_014/sol2.py)
974987
* Problem 015
975988
* [Sol1](project_euler/problem_015/sol1.py)
989+
* [Sol2](project_euler/problem_015/sol2.py)
976990
* Problem 016
977991
* [Sol1](project_euler/problem_016/sol1.py)
978992
* [Sol2](project_euler/problem_016/sol2.py)
@@ -1266,6 +1280,7 @@
12661280
* [Comb Sort](sorts/comb_sort.py)
12671281
* [Counting Sort](sorts/counting_sort.py)
12681282
* [Cycle Sort](sorts/cycle_sort.py)
1283+
* [Cyclic Sort](sorts/cyclic_sort.py)
12691284
* [Double Sort](sorts/double_sort.py)
12701285
* [Dutch National Flag Sort](sorts/dutch_national_flag_sort.py)
12711286
* [Exchange Sort](sorts/exchange_sort.py)
@@ -1296,6 +1311,7 @@
12961311
* [Shell Sort](sorts/shell_sort.py)
12971312
* [Shrink Shell Sort](sorts/shrink_shell_sort.py)
12981313
* [Slowsort](sorts/slowsort.py)
1314+
* [Stalin Sort](sorts/stalin_sort.py)
12991315
* [Stooge Sort](sorts/stooge_sort.py)
13001316
* [Strand Sort](sorts/strand_sort.py)
13011317
* [Tim Sort](sorts/tim_sort.py)

β€ŽREADME.mdβ€Ž

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<img src="https://raw.githubusercontent.com/TheAlgorithms/website/1cd824df116b27029f17c2d1b42d81731f28a920/public/logo.svg" height="100">
55
</a>
66
<h1><a href="https://github.com/TheAlgorithms/">The Algorithms</a> - Python</h1>
7+
78
<!-- Labels: -->
89
<!-- First row: -->
910
<a href="https://gitpod.io/#https://github.com/TheAlgorithms/Python">
@@ -19,6 +20,7 @@
1920
<a href="https://gitter.im/TheAlgorithms/community">
2021
<img src="https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square" height="20" alt="Gitter chat">
2122
</a>
23+
2224
<!-- Second row: -->
2325
<br>
2426
<a href="https://github.com/TheAlgorithms/Python/actions">
@@ -30,20 +32,21 @@
3032
<a href="https://docs.astral.sh/ruff/formatter/">
3133
<img src="https://img.shields.io/static/v1?label=code%20style&message=ruff&color=black&style=flat-square" height="20" alt="code style: black">
3234
</a>
35+
3336
<!-- Short description: -->
34-
<h3>All algorithms implemented in Python - for education</h3>
37+
<h3>All algorithms implemented in Python - for education πŸ“š</h3>
3538
</div>
3639

3740
Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion.
3841

39-
## Getting Started
42+
## πŸš€ Getting Started
4043

41-
Read through our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.
44+
πŸ“‹ Read through our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.
4245

43-
## Community Channels
46+
## 🌐 Community Channels
4447

4548
We are on [Discord](https://the-algorithms.com/discord) and [Gitter](https://gitter.im/TheAlgorithms/community)! Community channels are a great way for you to ask questions and get help. Please join us!
4649

47-
## List of Algorithms
50+
## πŸ“œ List of Algorithms
4851

4952
See our [directory](DIRECTORY.md) for easier navigation and a better overview of the project.

0 commit comments

Comments
Β (0)