Skip to content

Commit c643127

Browse files
authored
Merge branch 'TheAlgorithms:master' into master
2 parents b71e97a + 1158294 commit c643127

File tree

160 files changed

+3039
-737
lines changed

Some content is hidden

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

160 files changed

+3039
-737
lines changed

Diff for: .flake8

-10
This file was deleted.

Diff for: .github/ISSUE_TEMPLATE/other.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Other
2+
description: Use this for any other issues. PLEASE do not create blank issues
3+
labels: ["awaiting triage"]
4+
body:
5+
- type: textarea
6+
id: issuedescription
7+
attributes:
8+
label: What would you like to share?
9+
description: Provide a clear and concise explanation of your issue.
10+
validations:
11+
required: true
12+
13+
- type: textarea
14+
id: extrainfo
15+
attributes:
16+
label: Additional information
17+
description: Is there anything else we should know about this issue?
18+
validations:
19+
required: false

Diff for: .github/stale.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pulls:
4545
closeComment: >
4646
Please reopen this pull request once you commit the changes requested
4747
or make improvements on the code. If this is not the case and you need
48-
some help, feel free to seek help from our [Gitter](https://gitter.im/TheAlgorithms)
48+
some help, feel free to seek help from our [Gitter](https://gitter.im/TheAlgorithms/community)
4949
or ping one of the reviewers. Thank you for your contributions!
5050
5151
issues:
@@ -59,5 +59,5 @@ issues:
5959
closeComment: >
6060
Please reopen this issue once you add more information and updates here.
6161
If this is not the case and you need some help, feel free to seek help
62-
from our [Gitter](https://gitter.im/TheAlgorithms) or ping one of the
62+
from our [Gitter](https://gitter.im/TheAlgorithms/community) or ping one of the
6363
reviewers. Thank you for your contributions!

Diff for: .github/workflows/ruff.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# https://beta.ruff.rs
2+
name: ruff
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
jobs:
11+
ruff:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- run: pip install --user ruff
16+
- run: ruff --format=github .

Diff for: .pre-commit-config.yaml

+23-56
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ repos:
33
rev: v4.4.0
44
hooks:
55
- id: check-executables-have-shebangs
6+
- id: check-toml
67
- id: check-yaml
78
- id: end-of-file-fixer
89
types: [python]
@@ -14,81 +15,47 @@ repos:
1415
hooks:
1516
- id: auto-walrus
1617

18+
- repo: https://github.com/charliermarsh/ruff-pre-commit
19+
rev: v0.0.261
20+
hooks:
21+
- id: ruff
22+
1723
- repo: https://github.com/psf/black
18-
rev: 23.1.0
24+
rev: 23.3.0
1925
hooks:
2026
- id: black
2127

22-
- repo: https://github.com/PyCQA/isort
23-
rev: 5.12.0
28+
- repo: https://github.com/codespell-project/codespell
29+
rev: v2.2.4
2430
hooks:
25-
- id: isort
26-
args:
27-
- --profile=black
31+
- id: codespell
32+
additional_dependencies:
33+
- tomli
2834

2935
- repo: https://github.com/tox-dev/pyproject-fmt
30-
rev: "0.6.0"
36+
rev: "0.9.2"
3137
hooks:
3238
- id: pyproject-fmt
3339

34-
- repo: https://github.com/abravalheri/validate-pyproject
35-
rev: v0.12.1
36-
hooks:
37-
- id: validate-pyproject
38-
39-
- repo: https://github.com/asottile/pyupgrade
40-
rev: v3.3.1
41-
hooks:
42-
- id: pyupgrade
43-
args:
44-
- --py311-plus
45-
46-
- repo: https://github.com/PyCQA/flake8
47-
rev: 6.0.0
40+
- repo: local
4841
hooks:
49-
- id: flake8 # See .flake8 for args
50-
additional_dependencies: &flake8-plugins
51-
- flake8-bugbear
52-
- flake8-builtins
53-
# - flake8-broken-line
54-
- flake8-comprehensions
55-
- pep8-naming
42+
- id: validate-filenames
43+
name: Validate filenames
44+
entry: ./scripts/validate_filenames.py
45+
language: script
46+
pass_filenames: false
5647

57-
- repo: https://github.com/asottile/yesqa
58-
rev: v1.4.0
48+
- repo: https://github.com/abravalheri/validate-pyproject
49+
rev: v0.12.2
5950
hooks:
60-
- id: yesqa
61-
additional_dependencies:
62-
*flake8-plugins
51+
- id: validate-pyproject
6352

6453
- repo: https://github.com/pre-commit/mirrors-mypy
65-
rev: v0.991
54+
rev: v1.2.0
6655
hooks:
6756
- id: mypy
6857
args:
6958
- --ignore-missing-imports
7059
- --install-types # See mirrors-mypy README.md
7160
- --non-interactive
7261
additional_dependencies: [types-requests]
73-
74-
- repo: https://github.com/codespell-project/codespell
75-
rev: v2.2.2
76-
hooks:
77-
- id: codespell
78-
args:
79-
- --ignore-words-list=ans,crate,damon,fo,followings,hist,iff,mater,secant,som,sur,tim,zar
80-
exclude: |
81-
(?x)^(
82-
ciphers/prehistoric_men.txt |
83-
strings/dictionary.txt |
84-
strings/words.txt |
85-
project_euler/problem_022/p022_names.txt
86-
)$
87-
88-
- repo: local
89-
hooks:
90-
- id: validate-filenames
91-
name: Validate filenames
92-
entry: ./scripts/validate_filenames.py
93-
language: script
94-
pass_filenames: false

Diff for: CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Before contributing
44

5-
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before sending your pull requests, make sure that you __read the whole guidelines__. If you have any doubt on the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community in [Gitter](https://gitter.im/TheAlgorithms).
5+
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before sending your pull requests, make sure that you __read the whole guidelines__. If you have any doubt on the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community in [Gitter](https://gitter.im/TheAlgorithms/community).
66

77
## Contributing
88

@@ -81,11 +81,11 @@ We want your work to be readable by others; therefore, we encourage you to note
8181
black .
8282
```
8383

84-
- All submissions will need to pass the test `flake8 . --ignore=E203,W503 --max-line-length=88` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
84+
- All submissions will need to pass the test `ruff .` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
8585

8686
```bash
87-
python3 -m pip install flake8 # only required the first time
88-
flake8 . --ignore=E203,W503 --max-line-length=88 --show-source
87+
python3 -m pip install ruff # only required the first time
88+
ruff .
8989
```
9090

9191
- Original code submission require docstrings or comments to describe your work.
@@ -176,7 +176,7 @@ We want your work to be readable by others; therefore, we encourage you to note
176176

177177
- Most importantly,
178178
- __Be consistent in the use of these guidelines when submitting.__
179-
- __Join__ us on [Discord](https://discord.com/invite/c7MnfGFGa6) and [Gitter](https://gitter.im/TheAlgorithms) __now!__
179+
- __Join__ us on [Discord](https://discord.com/invite/c7MnfGFGa6) and [Gitter](https://gitter.im/TheAlgorithms/community) __now!__
180180
- Happy coding!
181181

182182
Writer [@poyea](https://github.com/poyea), Jun 2019.

Diff for: DIRECTORY.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,16 @@
195195
* [Alternate Disjoint Set](data_structures/disjoint_set/alternate_disjoint_set.py)
196196
* [Disjoint Set](data_structures/disjoint_set/disjoint_set.py)
197197
* Hashing
198+
* [Bloom Filter](data_structures/hashing/bloom_filter.py)
198199
* [Double Hash](data_structures/hashing/double_hash.py)
200+
* [Hash Map](data_structures/hashing/hash_map.py)
199201
* [Hash Table](data_structures/hashing/hash_table.py)
200202
* [Hash Table With Linked List](data_structures/hashing/hash_table_with_linked_list.py)
201203
* Number Theory
202204
* [Prime Numbers](data_structures/hashing/number_theory/prime_numbers.py)
203205
* [Quadratic Probing](data_structures/hashing/quadratic_probing.py)
206+
* Tests
207+
* [Test Hash Map](data_structures/hashing/tests/test_hash_map.py)
204208
* Heap
205209
* [Binomial Heap](data_structures/heap/binomial_heap.py)
206210
* [Heap](data_structures/heap/heap.py)
@@ -229,6 +233,7 @@
229233
* [Double Ended Queue](data_structures/queue/double_ended_queue.py)
230234
* [Linked Queue](data_structures/queue/linked_queue.py)
231235
* [Priority Queue Using List](data_structures/queue/priority_queue_using_list.py)
236+
* [Queue By Two Stacks](data_structures/queue/queue_by_two_stacks.py)
232237
* [Queue On List](data_structures/queue/queue_on_list.py)
233238
* [Queue On Pseudo Stack](data_structures/queue/queue_on_pseudo_stack.py)
234239
* Stacks
@@ -306,6 +311,7 @@
306311
* [Floyd Warshall](dynamic_programming/floyd_warshall.py)
307312
* [Integer Partition](dynamic_programming/integer_partition.py)
308313
* [Iterating Through Submasks](dynamic_programming/iterating_through_submasks.py)
314+
* [K Means Clustering Tensorflow](dynamic_programming/k_means_clustering_tensorflow.py)
309315
* [Knapsack](dynamic_programming/knapsack.py)
310316
* [Longest Common Subsequence](dynamic_programming/longest_common_subsequence.py)
311317
* [Longest Common Substring](dynamic_programming/longest_common_substring.py)
@@ -314,6 +320,7 @@
314320
* [Longest Sub Array](dynamic_programming/longest_sub_array.py)
315321
* [Matrix Chain Order](dynamic_programming/matrix_chain_order.py)
316322
* [Max Non Adjacent Sum](dynamic_programming/max_non_adjacent_sum.py)
323+
* [Max Product Subarray](dynamic_programming/max_product_subarray.py)
317324
* [Max Sub Array](dynamic_programming/max_sub_array.py)
318325
* [Max Sum Contiguous Subsequence](dynamic_programming/max_sum_contiguous_subsequence.py)
319326
* [Min Distance Up Bottom](dynamic_programming/min_distance_up_bottom.py)
@@ -334,6 +341,7 @@
334341
## Electronics
335342
* [Builtin Voltage](electronics/builtin_voltage.py)
336343
* [Carrier Concentration](electronics/carrier_concentration.py)
344+
* [Circular Convolution](electronics/circular_convolution.py)
337345
* [Coulombs Law](electronics/coulombs_law.py)
338346
* [Electric Conductivity](electronics/electric_conductivity.py)
339347
* [Electric Power](electronics/electric_power.py)
@@ -680,6 +688,7 @@
680688
* [2 Hidden Layers Neural Network](neural_network/2_hidden_layers_neural_network.py)
681689
* [Back Propagation Neural Network](neural_network/back_propagation_neural_network.py)
682690
* [Convolution Neural Network](neural_network/convolution_neural_network.py)
691+
* [Input Data](neural_network/input_data.py)
683692
* [Perceptron](neural_network/perceptron.py)
684693
* [Simple Neural Network](neural_network/simple_neural_network.py)
685694

@@ -710,6 +719,7 @@
710719
* [Archimedes Principle](physics/archimedes_principle.py)
711720
* [Casimir Effect](physics/casimir_effect.py)
712721
* [Centripetal Force](physics/centripetal_force.py)
722+
* [Grahams Law](physics/grahams_law.py)
713723
* [Horizontal Projectile Motion](physics/horizontal_projectile_motion.py)
714724
* [Hubble Parameter](physics/hubble_parameter.py)
715725
* [Ideal Gas Law](physics/ideal_gas_law.py)
@@ -914,10 +924,14 @@
914924
* [Sol1](project_euler/problem_077/sol1.py)
915925
* Problem 078
916926
* [Sol1](project_euler/problem_078/sol1.py)
927+
* Problem 079
928+
* [Sol1](project_euler/problem_079/sol1.py)
917929
* Problem 080
918930
* [Sol1](project_euler/problem_080/sol1.py)
919931
* Problem 081
920932
* [Sol1](project_euler/problem_081/sol1.py)
933+
* Problem 082
934+
* [Sol1](project_euler/problem_082/sol1.py)
921935
* Problem 085
922936
* [Sol1](project_euler/problem_085/sol1.py)
923937
* Problem 086
@@ -930,10 +944,14 @@
930944
* [Sol1](project_euler/problem_091/sol1.py)
931945
* Problem 092
932946
* [Sol1](project_euler/problem_092/sol1.py)
947+
* Problem 094
948+
* [Sol1](project_euler/problem_094/sol1.py)
933949
* Problem 097
934950
* [Sol1](project_euler/problem_097/sol1.py)
935951
* Problem 099
936952
* [Sol1](project_euler/problem_099/sol1.py)
953+
* Problem 100
954+
* [Sol1](project_euler/problem_100/sol1.py)
937955
* Problem 101
938956
* [Sol1](project_euler/problem_101/sol1.py)
939957
* Problem 102
@@ -954,6 +972,8 @@
954972
* [Sol1](project_euler/problem_115/sol1.py)
955973
* Problem 116
956974
* [Sol1](project_euler/problem_116/sol1.py)
975+
* Problem 117
976+
* [Sol1](project_euler/problem_117/sol1.py)
957977
* Problem 119
958978
* [Sol1](project_euler/problem_119/sol1.py)
959979
* Problem 120
@@ -966,6 +986,8 @@
966986
* [Sol1](project_euler/problem_125/sol1.py)
967987
* Problem 129
968988
* [Sol1](project_euler/problem_129/sol1.py)
989+
* Problem 131
990+
* [Sol1](project_euler/problem_131/sol1.py)
969991
* Problem 135
970992
* [Sol1](project_euler/problem_135/sol1.py)
971993
* Problem 144
@@ -978,6 +1000,8 @@
9781000
* [Sol1](project_euler/problem_174/sol1.py)
9791001
* Problem 180
9801002
* [Sol1](project_euler/problem_180/sol1.py)
1003+
* Problem 187
1004+
* [Sol1](project_euler/problem_187/sol1.py)
9811005
* Problem 188
9821006
* [Sol1](project_euler/problem_188/sol1.py)
9831007
* Problem 191
@@ -1002,6 +1026,8 @@
10021026
* [Sol1](project_euler/problem_587/sol1.py)
10031027
* Problem 686
10041028
* [Sol1](project_euler/problem_686/sol1.py)
1029+
* Problem 800
1030+
* [Sol1](project_euler/problem_800/sol1.py)
10051031

10061032
## Quantum
10071033
* [Bb84](quantum/bb84.py)
@@ -1011,6 +1037,7 @@
10111037
* [Q Fourier Transform](quantum/q_fourier_transform.py)
10121038
* [Q Full Adder](quantum/q_full_adder.py)
10131039
* [Quantum Entanglement](quantum/quantum_entanglement.py)
1040+
* [Quantum Random](quantum/quantum_random.py)
10141041
* [Quantum Teleportation](quantum/quantum_teleportation.py)
10151042
* [Ripple Adder Classic](quantum/ripple_adder_classic.py)
10161043
* [Single Qubit Measure](quantum/single_qubit_measure.py)
@@ -1163,7 +1190,6 @@
11631190
* [Get Amazon Product Data](web_programming/get_amazon_product_data.py)
11641191
* [Get Imdb Top 250 Movies Csv](web_programming/get_imdb_top_250_movies_csv.py)
11651192
* [Get Imdbtop](web_programming/get_imdbtop.py)
1166-
* [Get Top Billionaires](web_programming/get_top_billionaires.py)
11671193
* [Get Top Hn Posts](web_programming/get_top_hn_posts.py)
11681194
* [Get User Tweets](web_programming/get_user_tweets.py)
11691195
* [Giphy](web_programming/giphy.py)

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
<a href="https://discord.gg/c7MnfGFGa6">
1717
<img src="https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=7289DA&style=flat-square" height="20" alt="Discord chat">
1818
</a>
19-
<a href="https://gitter.im/TheAlgorithms">
19+
<a href="https://gitter.im/TheAlgorithms/community">
2020
<img src="https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square" height="20" alt="Gitter chat">
2121
</a>
2222
<!-- Second row: -->
2323
<br>
2424
<a href="https://github.com/TheAlgorithms/Python/actions">
25-
<img src="https://img.shields.io/github/workflow/status/TheAlgorithms/Python/build?label=CI&logo=github&style=flat-square" height="20" alt="GitHub Workflow Status">
25+
<img src="https://img.shields.io/github/actions/workflow/status/TheAlgorithms/Python/build.yml?branch=master&label=CI&logo=github&style=flat-square" height="20" alt="GitHub Workflow Status">
2626
</a>
2727
<a href="https://github.com/pre-commit/pre-commit">
2828
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" height="20" alt="pre-commit">
@@ -42,7 +42,7 @@ Read through our [Contribution Guidelines](CONTRIBUTING.md) before you contribut
4242

4343
## Community Channels
4444

45-
We are on [Discord](https://discord.gg/c7MnfGFGa6) and [Gitter](https://gitter.im/TheAlgorithms)! Community channels are a great way for you to ask questions and get help. Please join us!
45+
We are on [Discord](https://discord.gg/c7MnfGFGa6) and [Gitter](https://gitter.im/TheAlgorithms/community)! Community channels are a great way for you to ask questions and get help. Please join us!
4646

4747
## List of Algorithms
4848

0 commit comments

Comments
 (0)