Commit Graph

3351 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
79a327fc07
[pre-commit.ci] pre-commit autoupdate (#11106)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.1 → v0.1.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.1...v0.1.3)
- [github.com/psf/black: 23.10.0 → 23.10.1](https://github.com/psf/black/compare/23.10.0...23.10.1)
- [github.com/tox-dev/pyproject-fmt: 1.2.0 → 1.3.0](https://github.com/tox-dev/pyproject-fmt/compare/1.2.0...1.3.0)

* updating DIRECTORY.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-30 19:17:00 +01:00
Devashri Deulkar
ddd4023fe6
Happy number (new algorithm) (#10864)
* Happy number (new algorithm)

adding new algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/special_numbers/happy_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update happy_number.py

added new changes

* Update happy_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update happy_number.py

* Update happy_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update happy_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update happy_number.py

added ValueError part in code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update happy_number.py

modified and added raise Error code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update happy_number.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-30 19:15:49 +01:00
Mohammad Esfandiyar
ad9948d5d4
implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm (#10457)
* Adding new implementation

Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm

* Delete linear_algebra/src/GaussianEliminationpivoting.py

* Adding new implementation

Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm

* Delete linear_algebra/src/gaussianeliminationpivoting.py

* Adding new implementation

Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm 
for the third time because the last two times had conflict with the rules in PR

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Delete linear_algebra/src/gaussianeliminationpivoting.py

* Adding gaussianeliminationpivoting.py

Adding my python implementation of Gaussian Elimination pivoting as a numerical linear algebra algorithm 
for the fourth time because the last three times had conflict with the rules in PR and bots

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussianeliminationpivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussianeliminationpivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussianeliminationpivoting.py

I changed a to matrix and coeff_matrix for better clarity

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussianeliminationpivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussianeliminationpivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussianeliminationpivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update and rename gaussianeliminationpivoting.py to gaussian_elimination_pivoting.py

renamed the file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Delete linear_algebra/src/gaussian_elimination_pivoting.py

* Add files via upload

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Delete linear_algebra/src/gaussian_elimination_pivoting/text.py

* Add files via upload

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update linear_algebra/src/gaussian_elimination_pivoting/gaussian_elimination_pivoting.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* Update gaussian_elimination_pivoting.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-30 14:20:47 +01:00
dekomori_sanae09
c38b222212
serialize deserialize binary tree (#9625)
* added serialize and desrialize bin tree

* format files

* added type hints

* added type hints

* Use dataclass .__eq__(), .__iter__(), and .__repr__()

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-30 00:07:21 +01:00
Abílio Azevedo
2531f8e221
test: adding more tests to missing number algorithm (#10394)
* test: adding more tests to missing number algorithm

* Update missing_number.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 22:43:32 +01:00
chien liu
13e66c18d2
Fix typo power_using_recursion.py (#11083) 2023-10-29 22:22:19 +01:00
Khushi Shukla
c7a1331b34
Create karnaugh_map_simplification.py (#11056)
* Create karnaugh_map_simplification.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update karnaugh_map_simplification.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update karnaugh_map_simplification.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update karnaugh_map_simplification.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update karnaugh_map_simplification.py

* Update boolean_algebra/karnaugh_map_simplification.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update karnaugh_map_simplification.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update karnaugh_map_simplification.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update karnaugh_map_simplification.py

* Update karnaugh_map_simplification.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 22:20:57 +01:00
Aryansh B
760d9bedc1
Added Fast Inverse Square Root (#11054)
* Feat: Added Fast inverse square root

* Fix: Added typehint

* Fix: Added doctests that break the code, changed var name

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix: fixed length of docstring

* Update fast_inverse_sqrt.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 21:57:37 +01:00
dahhou ilyas
eafdb8b866
Dahhou ilyas (#10058)
* add new programme in dynamique programming wildcard_matching

* add new programme in dynamique programming wildcard_matching

* fix bug

* fix

* fix

* fix

* fix

* fix

* fix error recrusion

* fix error recrusion

* bug fix

* add doctest

* The power of enumerate()

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 18:24:37 +01:00
Aqib Javid Bhat
be60f42a5f
Add Josephus Problem (#10928)
* Add Josephus Problem

* Add iterative implementation of Josephus Problem

* Add descriptive variable names

* Update maths/josephus_problem.py

* Update josephus_problem.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 17:42:41 +01:00
Suyash Dongre
67c85ee289
Added doctest to hash_map.py (#11082)
* Added doctest to heap.py

* Added doctest to hash_map.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update hash_map.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 17:01:54 +01:00
dragon
3ad90cea83
add a yield method to fibonaci (#10826)
* add a yiled method to fibonaci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fibonaci

* Update fibonacci.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update fibonacci.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 16:40:01 +01:00
Arshdeep Singh Sachdeva
d59cf1734f
Add running key cipher (#10834)
* Add running key cipher

* update running key cipher add doctests and hints

* Add test case

* Update return value

* range(len()) is almost always a hint to use enumerate()

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 15:55:37 +01:00
Kento
6b588e4d44
Added doctests for fibonacci.py (#10836)
* added other possible cases

* added test for correct output of truth table

* few fibonacci tests added

* updating DIRECTORY.md

* Update nor_gate.py

* updating DIRECTORY.md

* Update fibonacci.py

removed whitespace

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: = <=>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-29 13:57:40 +01:00
Farzad Hayat
7c1dfec086
XOR Cipher: doctests and bug fixes (#10840)
* Fixed bug with key modulus wrapping. Should be wrapping on 256, not 255.

* Fixed bug with incorrect assertion type in decrypt function.

* Added doctests for 4 out of 6 methods
2023-10-29 13:57:04 +01:00
aayushsoni4
cc22d0b0ba
Generate parentheses (#10903)
* Add: Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Matrix Prefix Sum

* Add: Distinct Subsequences

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Distinct Subsequences

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changes made in Distinct Subsequences

* Changes made in Distinct Subsequences

* Changes made in Distinct Subsequences

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removed Distinct Subsequences

* Add: Generate Parentheses

* Add: Generate Parentheses

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add: Generate Parentheses

* Add: Generate Parentheses

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add: Generate Parentheses

* Add: Generate Parentheses

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update backtracking/generate_parentheses.py

* Delete matrix/matrix_prefix_sum.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 13:55:31 +01:00
Aqib Javid Bhat
403d3b8a29
Add Integer Square Root Algorithm (#10949)
* Add Integer Square Root Algorithm

* Update integer_square_root.py

* Update integer_square_root.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 11:58:28 +01:00
Tapas Singhal
8217f9bd35
Create find_previous_power_of_two.py (#11004)
* Create find_previous_power_of_two.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update find_previous_power_of_two.py

This change avoids the unnecessary left shift operation

* Update find_previous_power_of_two.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 11:25:39 +01:00
SEIKH NABAB UDDIN
adb13a1063
Update instagram_pic.py (#10957)
* Update instagram_pic.py

* Update instagram_pic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update instagram_pic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update instagram_pic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update instagram_pic.py

* Update instagram_pic.py

* Update instagram_pic.py

* Update instagram_pic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update instagram_pic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update instagram_pic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update instagram_pic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fast fail instead of nested ifs and PEP8: Keep try/except blocks small

* Update instagram_pic.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 10:52:50 +01:00
ojas wani
bad39cd154
Add more doctest to intro_sort.py #9943 (#11068)
* added laplacian_filter file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* required changes to laplacian file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update laplacian_filter.py

* update laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* changed laplacian_filter.py

* changed laplacian_filter.py

* add matrix_multiplication.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update matrix_multiplication

* update matrix_multiplication

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make changes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update

* update

* updates

* resolve conflict

* add doctest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make changes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update laplacian.py

* add doctests

* more doctest added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* try to resolve ruff error

* try to reslve ruff error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update doctest

* attemp - resolve ruff error

* resolve build error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* resolve build issue

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update build

* doctest update

* update doctest

* update doctest

* update doctest

* fix ruff error

* file location changed

* Delete digital_image_processing/filters/laplacian_filter.py

* Create laplacian_filter.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Add doctest to median_of_3

* add doctest to median_of_3 function

* Update intro_sort.py

* Update sorts/intro_sort.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 10:37:07 +01:00
Tapas Singhal
5019561681
Create multiplexer.py (#11064)
* Create multiplexer.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Doctests should show how the algorithm fails

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 08:42:32 +01:00
Ed
e3eb9daba4
Add bitap_string_match algo (#11060)
* Add bitap_string_match algo

* Fix types

* Fix spelling and add ignore word

* Add suggested changes and change return type

* Resolve suggestions
2023-10-29 00:48:50 +02:00
Tapas Singhal
aa5c97d72c
Create ipv4_conversion.py (#11008)
* Create ipconversion.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update conversions/ipconversion.py

* Update ipconversion.py

* Rename ipconversion.py to ipv4_conversion.py

* forward_propagation(32, 450_000)  # Was 10_000_000

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 00:47:46 +02:00
Ravi Kumar
444dfb0a0f
Added adams-bashforth method of order 2, 3, 4, 5 (#10969)
* added runge kutta gills method

* added adams-bashforth method of order 2, 3, 4, 5

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update adams_bashforth.py

* Deleted extraneous file, maths/numerical_analysis/runge_kutta_gills.py

* Added doctests to each function adams_bashforth.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update adams_bashforth.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-29 00:12:17 +02:00
Khushi Shukla
d80ee90178
Create crossword_puzzle_solver.py (#11011)
* Create crossword_puzzle_solver.py

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* Update backtracking/crossword_puzzle_solver.py

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update crossword_puzzle_solver.py

* Apply suggestions from code review

* Update crossword_puzzle_solver.py

* Update crossword_puzzle_solver.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-28 23:13:14 +02:00
Suyash Dongre
b51b833e0a
Added doctest to heap.py (#11059) 2023-10-28 21:43:20 +02:00
Shreya123714
f2436318ce
Add FuzzySet Class for Triangular Fuzzy Sets (#11036)
* Added Opertation for triangular fuzzy sets

* Added Sources

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix the bug , for which test were failing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add type hints and improve parameter names

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add Test For fuzzy_operations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix the bug in fuzzy_operations.py

* Add test_fuzzy_logic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix the bug in fuzzy_operations.py & deleted test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed the typo error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Again done

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* corrected wrong intendation due to which test fail

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* bug fixed

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add test_fuzzy_logic

* Modified fuzzy_operations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed the bug, made a FuzzySet dataclass

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Replaced assertEqual of unittest to assert python

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* lets see

* Changed test

* orderd the import statements

* Add docstring and dataclass the FuzzySet

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update fuzzy_operations.py

* Delete fuzzy_logic/test_fuzzy_logic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* https://en.wikipedia.org/wiki/Fuzzy_set

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-28 20:32:12 +02:00
Manmita Das
1e1ee00782
Excess 3 code (#11001)
* added excess-3 code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated with fixes

* updated with fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update excess_3_code.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-27 23:48:15 +02:00
Sanket Nikam
a0e80a74c8
Added Gradient Boosting Classifier (#10944)
* Added Gradient Boosting Classifier

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update gradient_boosting_classifier.py

* Update gradient_boosting_classifier.py

* Update gradient_boosting_classifier.py

* Update gradient_boosting_classifier.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-27 23:17:58 +02:00
Tiela Rose Black-Law
5df16f11eb
Add doctest to hashes/hamming_code.py (#10961) 2023-10-27 23:13:51 +02:00
RaymondDashWu
0eb1825af2
Tests for odd_even_transposition_parallel (#10926)
* [ADD] tests for odd_even_transposition_parallel

* adding another test because build failed 6 hrs

* comment out all tests to see if it fails

* list(range(10)[::-1]) test uncommented

* [a, x, c] test uncommented

* [1.9, 42.0, 2.8] test uncommented

* [False, True, False] test uncommented

* [1, 32.0, 9] test uncommented

* [1, 32.0, 9] test uncommented

* [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] test uncommented

* test non global lock

* [DEL] Testing multiple data types. Couldn't get doctest to work

* [ADD] Comment on why non global process lock
2023-10-27 22:13:32 +02:00
Adam Ross
b0837d3985
Increase code coverage for dijkstra algorithm (#10695)
* Increase code coverage for dijkstra algorithm

* Add missing code coverage

Refactor to pass mypy

* Fix missing code coverage

* Remove code changes, keep doctest

* Remove ALL of the code changes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dijkstra_algorithm.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-27 22:10:32 +02:00
Khushi Shukla
185a35589a
Create monotonic_array.py (#11025)
* Create monotonic_array.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update monotonic_array.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-27 12:42:34 -04:00
Suyash Dongre
f336cca8f8
Added doctest to double_hash.py (#11020)
* Added doctest to double_hash.py

* Update double_hash.py
2023-10-27 12:40:42 -04:00
Poojan Smart
e4eda14583
Add perplexity loss algorithm (#11028) 2023-10-27 10:44:33 -04:00
Suyash Dongre
34eb9c529a
Added doctest to hash_table.py (#11023)
* Added doctest to hash_table.py

* Update hash_table.py

* Update hash_table.py

* Update hash_table.py

* Update hash_table.py

* Apply suggestions from code review

* Update hash_table.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-27 14:36:43 +02:00
Poojan Smart
5987f86192
Add automatic differentiation algorithm (#10977)
* Added automatic differentiation algorithm

* file name changed

* Resolved pre commit errors

* updated dependency

* added noqa for ignoring check

* adding typing_extension for adding Self type in __new__

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* sorted requirement.text dependency

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* resolved ruff

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-27 10:47:24 +02:00
Suyash Dongre
fe4aad0ec9
Added doctest & docstring to quadratic_probing.py (#10996)
* Added doctest & docstring to quadratic_probing.py

* Update quadratic_probing.py

* Update quadratic_probing.py
2023-10-26 17:21:45 +02:00
Ed
a8dfd403f6
Add new algorithm index_2d_array_in_1d (#10973)
* Add new algorithm index_2d_array_in_1d

* Add doctest for iter function

* The power of dataclasses

* Update index_2d_array_in_1d.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-26 16:33:42 +02:00
Tiela Rose Black-Law
34b25c0c76
Add doctest for maths/primelib (#10978) 2023-10-26 14:52:47 +02:00
Kishan Kumar Rai
8adbf47c75
Fix Typo & Grammatical Errors (#10980) 2023-10-26 14:51:28 +02:00
Tianyi Zheng
579250363d
Speed up dijkstra_bankers_algorithm.py (#10861)
* updating DIRECTORY.md

* Rename dijkstra_bankers_algorithm.py

* Remove sleep() call

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-26 14:36:53 +02:00
Akash_Jambulkar
69f7f3208e
Update cocktail_shaker_sort.py (#10987)
* Update cocktail_shaker_sort.py

Added a docstring with clear explanations of the function and its parameters.

Changed variable names i, start, and end for better readability.

Improved comments to describe the purpose of each section of the algorithm.

Adjusted the loop ranges to make the code more concise and readable.

Removed redundant comments and variable assignments.

Provided a clear message when printing the sorted list.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update cocktail_shaker_sort.py

* typing: ignore[operator]

* Update cocktail_shaker_sort.py

* Update cocktail_shaker_sort.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-26 14:27:31 +02:00
Suyash Dongre
29b8ccdc2f
Added doctest to hash_table.py (#10984) 2023-10-26 14:12:28 +02:00
Habip Akyol
42c49ee117
Fix typo in haralick_descriptors.py (#10988) 2023-10-26 13:24:17 +02:00
Neha
6497917352
Added Kth largest element algorithm (#10687)
* neha3423

* neha3423

* neha3423

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* neha3423

* neha3423

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* neha323

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* neha3423

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* neha3423

* neha3423

* neha3423

* neha3423

* Added test case for tuple

* Update kth_largest_element.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-26 10:54:30 +02:00
Saurabh Mahapatra
ade2837e41
Update capitalize.py (#10573)
* Update capitalize.py

* Update strings/capitalize.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-26 04:25:08 -04:00
Mary-0165
e791a2067b
Capacitor equivalence algorithm (#9814)
* capacitor equivalence algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* Update capacitor_equivalence.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-26 04:10:13 -04:00
Sanjay
e5a6a97c32
Added Lens formulae to the Physics repository (#10187)
* Added Lens formulae to the Physics repository

* Resolved the commented issues

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update lens_formulae.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-26 03:58:40 -04:00
Suyash Dongre
dd7d18d49e
Added doctest, docstring and typehint for sigmoid_function & cost_function (#10828)
* Added doctest for sigmoid_function & cost_function

* Update logistic_regression.py

* Update logistic_regression.py

* Minor formatting changes in doctests

* Apply suggestions from code review

* Made requested changes in logistic_regression.py

* Apply suggestions from code review

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-26 03:55:56 -04:00