Commit Graph

3232 Commits

Author SHA1 Message Date
Aakash Giri
3ba2338479
Add Title Case Conversion (#10439)
[pre-commit.ci] auto fixes from pre-commit.com hooks

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

added more test case and type hint

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

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

updated naming convention
2023-10-14 18:17:11 +02:00
Dean Bring
212cdfe36c
Added validate sudoku board function (#9881)
* Added algorithm to deeply clone a graph

* Fixed file name and removed a function call

* Removed nested function and fixed class parameter types

* Fixed doctests

* bug fix

* Added class decorator

* Updated doctests and fixed precommit errors

* Cleaned up code

* Simplified doctest

* Added doctests

* Code simplification

* Created function which validates sudoku boards

* Update matrix/validate_sudoku_board.py

* Fixed precommit errors

* Removed file accidentally included

* Improved readability and simplicity

* Add timeit benchmarks

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

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

* Update validate_sudoku_board.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-14 17:35:12 +02:00
Tianyi Zheng
71b372f5e2
Remove doctest in xgboost_regressor.py main function (#10422)
* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Update xgboost_regressor.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-14 15:34:05 +02:00
Muhammad Umer Farooq
37cae3f561
Updated test cases of power_sum.py (#9978)
* Updated test cases of power_sum.py

* updated

* updated.

* remove extra comment and used ** instead of pow

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

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

* Update backtracking/power_sum.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: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-14 04:31:43 -04:00
Baron105
0b2c9fb6f1
Adding avg and mps speed formulae for ideal gases (#10229)
* avg and mps speed formulae added

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

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

* avg and mps speed formulae added

* fixed_spacing

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

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

* spacing

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

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

* ws

* added amicable numbers

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

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

* added amicable numbers

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

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

* spacing

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

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

* removed

* changed name of file and added code improvements

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

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

* issues fixed due to pi

* requested changes added

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-14 03:01:23 -04:00
Dale Dai
9fb0cd271e
Expand euler phi function doctest (#10401) 2023-10-14 02:47:08 -04:00
SalmanSi
d96029e13d
added doctests for dynamicprogramming/minimum_partition (#10033)
* added doctests

* added doctests

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

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

* Add doctests to integer_partition.py

* Update minimum_partition.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-13 19:48:31 +02:00
Saurabh Mahapatra
1117a50665
Modified comments on lower.py (#10369) 2023-10-13 11:55:32 -04:00
Saahil Mahato
c85506262d
Add Damerau-Levenshtein distance algorithm (#10159)
* Add Damerau-Levenshtein distance algorithm

* fix: precommit check

* fix: doc correction

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

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

* refactor: use variable for length and doc correction

* Update damerau_levenshtein_distance.py

* Update damerau_levenshtein_distance.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-13 15:18:52 +02:00
Saahil Mahato
ebe66935d2
Add Solovay-Strassen Primality test (#10335)
* Add Solovay-Strassen Primality test

* fix: resolve comments

* refactor: docs change
2023-10-13 08:04:48 +02:00
Daniela Large
24f6f8c137
Added nimply gate to boolean_algebra (#10344)
* Add files via upload

* Update imply_gate.py

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

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

* Update boolean_algebra/imply_gate.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update imply_gate.py

Made changes requested

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

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

* Update imply_gate.py

* Added nimply gate

* [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: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-13 00:29:39 -04:00
Pranavkumar Mallela
b94cdbab1a
add find triplets with 0 sum (3sum) (#10040)
* add find triplets with 0 sum (3sum)

* Update find_triplets_with_0_sum.py

* Update find_triplets_with_0_sum.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-12 21:51:53 +02:00
Daniela Large
ecf21bfc87
Added imply gate to boolean algebra (#9849)
* Add files via upload

* Update imply_gate.py

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

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

* Update boolean_algebra/imply_gate.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update imply_gate.py

Made changes requested

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

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

* Update imply_gate.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-12 11:51:06 -04:00
Poojan Smart
7ea812996c
Adds exponential moving average algorithm (#10273)
* Adds exponential moving average algorithm

* code clean up

* spell correction

* Modifies I/O types of function

* Replaces generator function

* Resolved mypy type error

* readibility of code and documentation

* Update exponential_moving_average.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-12 15:54:07 +02:00
Siddharth Warrier
09ce6b23d7
Count pairs with given sum (#10282)
* added power_of_4

* deleted power_of_4

* added pairs_with_given_sum

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

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

* updated the comment

* updated return hint

* updated type hints

* updated the variable

* updated annotation

* updated code

* updated code

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

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

* added the problem link and used defaultdict

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

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

* corrected import formatting

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

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

* Update pairs_with_given_sum.py

* Update data_structures/arrays/pairs_with_given_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-12 11:08:55 +02:00
Vipin Karthic
92fbe60082
Added doctests to carmichael_number.py (#10210)
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-11 15:05:24 -04:00
Christian Clauss
3f094fe49d
Ruff pandas vet (#10281)
* Python linting: Add ruff rules for Pandas-vet and Pytest-style

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-11 14:30:02 -04:00
Aasheesh
d5323dbaee
Adding doctests in simpson_rule.py (#10269)
* Adding doctests in simpson_rule.py

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

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

* Update maths/simpson_rule.py

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

* Update maths/simpson_rule.py

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

* Adding doctests in simpson_rule.py

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

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

* Adding doctests in simpson_rule.py

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

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

* Adding doctests in simpson_rule.py

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

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

* Adding doctests in simpson_rule.py

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

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

* Adding doctests in simpson_rule.py

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

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

* Update simpson_rule.py

* Adding doctests in simpson_rule.py

* Adding doctests in simpson_rule.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-11 20:20:18 +02:00
Ricardo Martinez Peinado
5fb6496d1b
Improve primelib.py test coverage #9943 (#10251)
* Update the doctest of primelib.py

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

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

* Correct errors for the doctest of primelib.py

* last error for the doctest of primelib.py

* last error for the doctest of primelib.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-11 12:11:05 +02:00
hollowcrust
672fda9130
Fix bug and edit doctests for infix_to_prefix_conversion (#10259)
* Fix bug and edit doctests

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

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

* Add type hints, raiseError and other minor adjustments

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

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

* Cleaning code

* [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-11 11:00:49 +02:00
cornbread-eater
c850227bee
Add doctests to primelib.py (#10242)
* Update primelib.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-10 23:07:07 +02:00
Kamil
0070739233
k_means_clust - change to remove warning (#10244)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* the change removes the warning:
/home/runner/work/Python/Python/machine_learning/k_means_clust.py:236: FutureWarning: The provided callable <function sum at 0x7f20c02034c0> is currently using SeriesGroupBy.sum. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "sum" instead.
     .agg(

And

/home/runner/work/Python/Python/machine_learning/k_means_clust.py:236: FutureWarning: The provided callable <function mean at 0x7f3d7db1c5e0> is currently using SeriesGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "mean" instead.
     .agg(
2023-10-10 16:18:31 -04:00
Kamil
9a5a6c663c
carmichael_number - add doctests (#10038)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* Added doctests

* Update carmichael_number.py

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

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

* Update carmichael_number.py

I make an empty commit to reset:
tests are failing.

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

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

* Update carmichael_number.py

Made changes taking into account the addition: 
from maths.greatest_common_divisor import greatest_common_divisor.

Now instead of gcd it is used: greatest_common_divisor.

* Update carmichael_number.py

* Update carmichael_number.py

* Update carmichael_number.py

I added a check for 0 and negative numbers in the tests and the code itself. Simplified obtaining the final result.

* Update carmichael_number.py

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

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

* Update maths/carmichael_number.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update carmichael_number.py

* Update carmichael_number.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-10 16:14:13 -04:00
hollowcrust
5be5d21bed
Add tests for infix_2_postfix() in infix_to_prefix_conversion.py (#10095)
* Add doctests, exceptions, type hints and fix bug for infix_to_prefix_conversion.py

Add doctests
Add exceptions for expressions with invalid bracket positions
Add type hints for functions
Fix a bug on line 53 (57 in PR)

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

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

* Change type hints in infix_to_prefix_conversion.py

* Remove printing trailing whitespace in the output table

* Fix type hint errors

* Fix doctests

* Adjust table convention in output and doctests

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

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

* Add doctests for infix_2_postfix()

* Update print_width

* Update print_width

* Fix the doctests

---------

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-10 18:52:53 +02:00
Kamil
0b440285e8
Gaussian_elemination - change to remove warning (#10221)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* Removes the warning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation
2023-10-10 10:24:51 -04:00
Arnav Kohli
59fc0cefef
Added categorical_crossentropy loss function (#10152) 2023-10-10 09:20:49 -04:00
Vipin Karthic
6d13603667
Fixes #9943 Added Doctests to binary_exponentiation_3.py (#10121)
* Python mirror_formulae.py is added to the repository

* Changes done after reading readme.md

* Changes for running doctest on all platforms

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

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

* Change 2 for Doctests

* Changes for doctest 2

* updating DIRECTORY.md

* Doctest whitespace error rectification to mirror_formulae.py

* updating DIRECTORY.md

* Adding Thermodynamic Work Done Formulae

* Work done on/by body in a thermodynamic setting

* updating DIRECTORY.md

* updating DIRECTORY.md

* Doctest adiition to binary_exponentiation_3.py

* Change 1

* updating DIRECTORY.md

* Rename binary_exponentiation_3.py to binary_exponentiation_2.py

* updating DIRECTORY.md

* updating DIRECTORY.md

* Formatting

---------

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>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-10 01:52:37 -04:00
Paarth Goyal
f3acb52cad
Added the algorithm to compute Reynolds number in the physics section (#9913)
* added the algorithm to compute Reynolds number

* fixed file name issue

* Apply suggestions from code review

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-10 01:24:04 -04:00
AkhilYadavPadala
9c02f1220e
seperation between description and docstrings (#9687)
* seperation between description and docstrings

* Update maths/factorial.py

---------

Co-authored-by: sarayu sree <sarayusreeyadavpadala@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-10 01:13:32 -04:00
dimonalik
1b4c4e7db2
Made problem explanation more clear (#9841)
* Update minimum_steps_to_one.py

Made the problem explanation more clear and readable

* updating DIRECTORY.md

* Apply suggestions from code review

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-10 00:34:36 -04:00
Md Mahiuddin
4f8fa3c44a
TypeError for non-integer input (#9250)
* type error check

* remove str input

* [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-10 00:19:40 -04:00
Kamil
7b996e2c22
backtracking -> word_search - replacing the example in doctest (#10188)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* Replacing the example in doctest with a less resource-intensive example.
2023-10-10 00:16:02 -04:00
Dean Bring
b9a797f3d4
Added the Minkowski distance function (#10143)
* Added the Minkowski distance function

* Made error handling more precise

* Added note about floating point errors and corresponding doctest
2023-10-09 19:00:37 -04:00
pre-commit-ci[bot]
53638fcec4
[pre-commit.ci] pre-commit autoupdate (#10197)
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-09 23:38:32 +02:00
Dean Bring
b0aa35c7b3
Added the Chebyshev distance function (#10144)
* Added the Chebyshev distance function

* Remove float cast and made error handling more precise
2023-10-09 17:21:46 -04:00
aryan1165
5d0a46814e
Added ciphers/permutation_cipher.py. (#9163)
* Added permutation_cipher.py

* Added type hints for parameters

* Added doctest in functions

* Update ciphers/permutation_cipher.py

Ya i felt the same but held back because there is a implementation of transposition_cipher.py. But that's is different from the one i have implemented here.

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update ciphers/permutation_cipher.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update ciphers/permutation_cipher.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update ciphers/permutation_cipher.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update ciphers/permutation_cipher.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update ciphers/permutation_cipher.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update ciphers/permutation_cipher.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

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

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

* Changes

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-09 15:38:04 -04:00
Christian Clauss
844270c6e9
Remove backslashes from is_palindrome.py (#10169)
@SaiHarshaK Fixes https://github.com/TheAlgorithms/Python/pull/10081#discussion_r1349651289
2023-10-10 06:42:07 +13:00
Kamil
ba828fe621
test_digital_image_processing -> test_local_binary_pattern replacing a large image with a smaller one (#10161)
* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* Replaced lena.jpg with lena_small.jpg to make tests faster.

* Update digital_image_processing/test_digital_image_processing.py

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

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

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

* Update test_digital_image_processing.py

tests fail, I'll try an empty commit

* Apply suggestions from code review

* Update test_digital_image_processing.py

added clarifications

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

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

* Update test_digital_image_processing.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>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-09 17:46:38 +02:00
Sai Harsha Kottapalli
c0da015b7d
Add DocTests to diffie.py (#10156)
* diffie doctest

* fix ut

* update doctest

---------

Co-authored-by: Harsha Kottapalli <skottapalli@microsoft.com>
2023-10-09 17:19:05 +02:00
Kausthub Kannan
53d78b9cc0
Added Huber Loss Function (#10141) 2023-10-09 10:33:47 -04:00
Siddik Patel
583a614fef
Removed redundant greatest_common_divisor code (#9358)
* Deleted greatest_common_divisor def from many files and instead imported the method from Maths folder

* Deleted greatest_common_divisor def from many files and instead imported the method from Maths folder, also fixed comments

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

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

* Deleted greatest_common_divisor def from many files and instead imported the method from Maths folder, also fixed comments

* Imports organized

* recursive gcd function implementation rolledback

* more gcd duplicates removed

* more gcd duplicates removed

* Update maths/carmichael_number.py

* updated files

* moved a file to another location

---------

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-09 14:19:12 +02:00
Sai Harsha Kottapalli
876087be99
Add DocTests to magicdiamondpattern.py (#10135)
* magicdiamondpattern doctest

* remove start part

---------

Co-authored-by: Harsha Kottapalli <skottapalli@microsoft.com>
2023-10-09 14:16:43 +02:00
Sai Harsha Kottapalli
12e8e9ca87
Add DocTests to is_palindrome.py (#10081)
* add doctest ut

* test complete

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

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

* format

* ruff update

* cover line 154

* Update data_structures/linked_list/is_palindrome.py

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

* use dataclass

* pre-commit fix

* Fix mypy errors

* use future annotations

---------

Co-authored-by: Harsha Kottapalli <skottapalli@microsoft.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-09 14:06:16 +02:00
Saahil Mahato
ed19b1cf0c
Add binary step activation function (#10030)
* Add binary step activation function

* fix: ruff line too long error

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

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

* refactor: add link to directory

* revert: add link to directory

* fix: algorithm bug and docs

* Update neural_network/activation_functions/binary_step.py

* fix: ruff line too long error

---------

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-08 19:34:50 -04:00
Saahil Mahato
2260961a80
Add Soboleva Modified Hyberbolic Tangent function (#10043)
* Add Sobovela Modified Hyberbolic Tangent function

* fix: typo

* Update and rename sobovela_modified_hyperbolic_tangent.py to soboleva_modified_hyperbolic_tangent.py

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

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

* fix: typo

* Apply suggestions from code review

---------

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-08 19:19:28 -04:00
Megan Payne
a2b695dabd
Added Germain primes algorithm to the maths folder (#10120)
* Added algorithm for Germain Primes to maths folder

* Fixed test errors Germain primes.

* Formatting Germain primes after pre-commit

* Fixed path to maths

* Update maths/germain_primes.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update maths/germain_primes.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Added function for safe primes

* Update maths/germain_primes.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Apply suggestions from code review

---------

Co-authored-by: Megan Payne <payneconsulting.nl@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-08 17:33:50 -04:00
Anshu Sharma
66e4ea6a62
Consolidated two scripts reverse_letters.py and reverse_long_words.py into one (#10140)
* Conolidated two scripts reverse_letters.py and reverse_long_words.py into one because of similar functionality

* Added a new line to accomodate characters without going over 88 char limit

* fixed grammar to pass pre-commit

* Changed faulty test case entirely to pass pre commit

* fixed a test case which was wrong

---------

Co-authored-by: Keyboard-1 <142900182+Keyboard-1@users.noreply.github.com>
2023-10-09 09:17:22 +13:00
halfhearted
2d02500332
equilibrium index in an array (#9856)
* equilibrium index in an array

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

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

* equilibrium index in an array

* equilibrium index in an array

* equilibrium index in an array removed type in docstring

---------

Co-authored-by: ArunSiva <Arunsiva003@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-09 08:44:49 +13:00
Tianyi Zheng
8e108ed92a
Rename maths/binary_exponentiation_3.py (#9656)
* updating DIRECTORY.md

* Rename binary_exponentiation_3.py

Rename binary_exponentiation_3.py to binary_exponentiation_2.py because
the original binary_exponentiation_2.py was renamed to
binary_multiplication.py in PR #9513

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-09 08:43:07 +13:00
Achal Jain
17de908d1a
Added Median of Medians Algorithm (#9864)
* Added Median of Medians Algorithm

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

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

* Update median_of_medians.py as per requested changes

* [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-09 08:41:30 +13:00