Commit Graph

3035 Commits

Author SHA1 Message Date
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
Siddharth Warrier
c8f6f79f80
Power of 4 (#9505)
* added power_of_4

* updated power_of_4

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

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

* updated power_of_4

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

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

* updated power_of_4

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

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

* updated power_of_4

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

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

* updated power_of_4

* added type check

* added tescase

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-09 08:40:14 +13:00
SubhranShu2332
e7a59bfff5
In place of calculating the factorial several times we can run a loop k times to calculate the combination (#10051)
* In place of calculating the factorial several times we can run a loop k times to calculate the combination 

for example:
5 C 3 = 5! / (3! * (5-3)! )
= (5*4*3*2*1)/[(3*2*1)*(2*1)]
=(5*4*3)/(3*2*1)
so running a loop k times will reduce the time complexity to O(k)

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

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

* Update maths/combinations.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-08 15:17:02 -04:00
Kosuri L Indu
982bc27358
add : Best time to buy and sell stock program under GREEDY methods (#10114)
* to add best_time_stock program

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

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

* Update best_time_to_buy_and_sell_stock.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-08 19:07:02 +02:00
Saurabh Mahapatra
e89ae55d8e
Create strip.py (#10011)
* Create strip.py

* Update strip.py
2023-10-08 12:10:41 -04:00
Kausthub Kannan
a12b07f352
Added Squareplus Activation Function (#9977)
* Added Squareplus Activation Function

* Added parameter beta to the function

* Fixed Squareplus Function

* Update neural_network/activation_functions/squareplus.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-08 12:08:37 -04:00
Arnav Kohli
81b29066d2
Created folder for losses in Machine_Learning (#9969)
* Created folder for losses in Machine_Learning

* Update binary_cross_entropy.py

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

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

* Update mean_squared_error.py

* Update binary_cross_entropy.py

* Update mean_squared_error.py

* Update binary_cross_entropy.py

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

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

* Update mean_squared_error.py

* Update binary_cross_entropy.py

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

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

* Update mean_squared_error.py

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

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

* Update binary_cross_entropy.py

* Update mean_squared_error.py

* Update binary_cross_entropy.py

* Update mean_squared_error.py

* Update machine_learning/losses/binary_cross_entropy.py

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

* Update machine_learning/losses/mean_squared_error.py

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

* Update machine_learning/losses/binary_cross_entropy.py

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

* Update mean_squared_error.py

* Update machine_learning/losses/mean_squared_error.py

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

* Update binary_cross_entropy.py

* Update mean_squared_error.py

* Update binary_cross_entropy.py

* Update mean_squared_error.py

* Update mean_squared_error.py

* Update binary_cross_entropy.py

* renamed: losses -> loss_functions

* updated 2 files

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

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

* Update mean_squared_error.py

* Update mean_squared_error.py

* Update binary_cross_entropy.py

* Update mean_squared_error.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>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-08 12:04:43 -04:00
Aarya Balwadkar
6860daea60
Made Changes shifted CRT, modular division to maths directory (#10084) 2023-10-08 11:53:38 -04:00
Kausthub Kannan
08d394126c
Changed Mish Activation Function to use Softplus (#10111) 2023-10-08 11:48:22 -04:00
Om Alve
937ce83b15
Added fractionated_morse_cipher (#9442)
* Added fractionated_morse_cipher

* Added return type hint for main function

* Added doctest for main

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

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

* Replaced main function

* changed the references section

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

* removed repetitive datatype hint in the docstring

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

* changed dictionary comprehension variable names to something more compact

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

* Update fractionated_morse_cipher.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-08 13:05:01 +02:00
hollowcrust
fa077e6703
Add doctests, type hints; fix bug for dynamic_programming/minimum_partition.py (#10012)
* Add doctests, type hints; fix bug

* [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-08 10:58:48 +02:00
pre-commit-ci[bot]
895dffb412
[pre-commit.ci] pre-commit autoupdate (#9543)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.291 → v0.0.292](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.291...v0.0.292)
- [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6)
- [github.com/tox-dev/pyproject-fmt: 1.1.0 → 1.2.0](https://github.com/tox-dev/pyproject-fmt/compare/1.1.0...1.2.0)

* updating DIRECTORY.md

* Fix typos in test_min_spanning_tree_prim.py

* Fix typos

* codespell --ignore-words-list=manuel

---------

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: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-07 21:32:28 +02:00
Kosuri L Indu
60291738d2
add : trapped water program under dynamic programming (#10027)
* to add the trapped water program

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

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

* to make changes for error : B006

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

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

* to make changes for error : B006

* to make changes for error : B006

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

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

* to make changes in doctest

* to make changes in doctest

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

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

* Update dynamic_programming/trapped_water.py

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

* Update dynamic_programming/trapped_water.py

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

* to make changes in parameters

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

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

* to make changes in parameters

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

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

* Update dynamic_programming/trapped_water.py

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

* to make changes in parameters

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

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

* for negative heights

* Update dynamic_programming/trapped_water.py

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

* to remove falsy

* Final edits

* tuple[int, ...]

---------

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-07 21:08:38 +02:00
dhruvtrigotra
112daddc4d
charging_capacitor (#10016)
* charging_capacitor

* charging_capacitor

* Final edits

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-07 21:04:24 +02:00
Pronay Debnath
78af0c43c6
Create fractional_cover_problem.py (#9973)
* Create fractional_cover_problem.py

* Update fractional_cover_problem.py

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

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

* Update fractional_cover_problem.py

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

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

* Update fractional_cover_problem.py

* Update fractional_cover_problem.py

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

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

* Update fractional_cover_problem.py

* Update fractional_cover_problem.py

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

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

* Update fractional_cover_problem.py

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

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

* Lose __eq__()

* Update fractional_cover_problem.py

* Define Item property ratio

---------

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-07 17:51:30 +02:00
Saahil Mahato
678e0aa8cf
Mention square matrices in strassen docs and make it more clear (#9839)
* refactor: fix strassen matrix multiplication docs

* refactor: make docs more clear
2023-10-07 05:35:23 -04:00
Kamil
2122474e41
Segmented sieve - doctests (#9945)
* 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 segmented_sieve.py

Removed unnecessary check.

* Update segmented_sieve.py

Added checks for 0 and negative numbers.

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

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

* Update segmented_sieve.py

* Update segmented_sieve.py

Added float number check.

* Update segmented_sieve.py

* Update segmented_sieve.py

simplified verification

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

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

* Update segmented_sieve.py

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

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

* Update segmented_sieve.py

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

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

* ValueError: Number 22.2 must instead be a positive integer

---------

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-07 05:09:39 -04:00
Kausthub Kannan
80a2087e0a
Added Softplus activation function (#9944) 2023-10-06 16:26:09 -04:00
Kausthub Kannan
c6ec99d571
Added Mish Activation Function (#9942)
* Added Mish Activation Function

* Apply suggestions from code review

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-06 15:23:05 -04:00
fxdup
995c5533c6
Consolidate gamma (#9769)
* refactor(gamma): Append _iterative to func name

* refactor(gamma): Consolidate implementations

* refactor(gamma): Redundant test function removal

* Update maths/gamma.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-06 14:46:58 -04:00
Sarvjeet Singh
795e97e87f
Added Majority Voting Algorithm (#9866)
* Create MajorityVoteAlgorithm.py

* Update and rename MajorityVoteAlgorithm.py to majorityvotealgorithm.py

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

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

* Update and rename majorityvotealgorithm.py to majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

* Update other/majority_vote_algorithm.py

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

* renaming variables majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

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

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

* Update other/majority_vote_algorithm.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 other/majority_vote_algorithm.py

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

* adding more testcases majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.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-06 15:49:34 +02:00
Christian Clauss
d0c54acd75
Use dataclasses in singly_linked_list.py (#9886) 2023-10-06 15:31:11 +13:00
JeevaRamanathan
17af644449
Symmetric tree (#9871)
* symmectric tree

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

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

* removed trailing spaces

* escape sequence fix

* added return type

* added class

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

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

* wordings fix

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

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

* added static method

* added type

* added static method

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

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

* wordings fix

* testcase added

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

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

* testcase added for mirror function

* testcase added for mirror function

* made the requested changes

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

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

* made the requested changes

* doc test added for symmetric, asymmetric

* Update symmetric_tree.py

---------

Co-authored-by: jeevaramanthan.m <jeevaramanathan.m@infosys.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-06 02:00:58 +02:00
ojas wani
19fc788197
added laplacian_filter file (#9783)
* 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

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

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

* Update laplacian_filter.py

* Add a test

---------

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-06 01:43:45 +02:00
Aroson
9200c64464
Added Wheatstone Bridge Algorithm (#9872)
* Add files via upload

* Update wheatstone_bridge.py

* Update wheatstone_bridge.py
2023-10-06 01:16:51 +02:00
Dean Bring
cd684fd947
Added algorithm to deeply clone a graph (#9765)
* 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
2023-10-06 00:45:40 +02:00
Abul Hasan
b316a96128
Match a pattern and String using backtracking (#9861)
* Fix: Issue 9588

* Fix: Issue 9588

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

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

* Fix: Issue 9588

* Fix: Issue #9588

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

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

* Fix: Issue #9588

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

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

* Fix: Issue #9588

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

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

* fix: issue #9793

* fix: issue #9793

* fix: issue #9588

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

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

* fix: issue #9844

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

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

* fix: issue #9844

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

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

* fix: issue #9844

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

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

* fix: issue #9844

* [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-06 11:45:10 +13:00
Akshay B Shetty
13317e4f7f
feat: calculating the resitance of resistor using color codes (#9874) 2023-10-06 11:27:13 +13:00
Marek Mazij
7f94a73eec
camelCase to snake_case conversion - Fixes #9726 (#9727)
* First commit

camel case to snake case conversion algorithm, including numbers

* code modified to not use regex
2023-10-06 11:05:23 +13:00
Christian Clauss
5869fda742
print reverse: A LinkedList with a tail pointer (#9875)
* print reverse: A LinkedList with a tail pointer

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-06 10:55:13 +13:00
Muhammad Umer Farooq
cffdf99c55
Updated prime_numbers.py testcases. (#9851)
* Updated prime_numbers.py testcases.

* revert __main__ code.
2023-10-05 20:44:55 +02:00
Pronay Debnath
b76115e8d1
Updated check_bipartite_graph_dfs.py (#9525)
* Create dijkstra_algorithm.py

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

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

* Update dijkstra_algorithm.py

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

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

* Update dijkstra_algorithm.py

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

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

* Update dijkstra_algorithm.py

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

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

* Delete greedy_methods/dijkstra_algorithm.py

* Update check_bipartite_graph_dfs.py

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

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

* Update check_bipartite_graph_dfs.py

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

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

* Update graphs/check_bipartite_graph_dfs.py

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

* Update graphs/check_bipartite_graph_dfs.py

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

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

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

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

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

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

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

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

* Update check_bipartite_graph_dfs.py

* Let's use self-documenting variable names

This is complex code so let's use self-documenting function and variable names to help readers to understand.

We should not shorten names to simplify the code formatting but use understandable name and leave to code formatting to psf/black.

I am not sure if `nbor` was supposed to be `neighbour`.  ;-)

* Update check_bipartite_graph_dfs.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-05 19:33:05 +02:00
Parth
87494f1fa1
largest divisible subset (#9825)
* largest divisible subset

* minor tweaks

* adding more test cases

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

* improving code for better readability

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

* update

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

* update

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

* suggested changes done, and further modfications

* final update

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

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

* Update largest_divisible_subset.py

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

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

* Update largest_divisible_subset.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-05 18:21:28 +02:00
Aasheesh
deb0480b3a
Changing the directory of sigmoid_linear_unit.py (#9824)
* Changing the directory of sigmoid_linear_unit.py

* Delete neural_network/activation_functions/__init__.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-05 10:07:44 -04:00
Wei Jiang
55ee273419
[bug fixing] Edge case of the double ended queue (#9823)
* fix the edge case of the double ended queue pop the last element

* refactoring doc

---------

Co-authored-by: Jiang15 <weijiang@weijiangs-MacBook-Pro.local>
2023-10-05 10:00:48 -04:00
Adebisi Ahmed
6643c95537
add gas station (#9446)
* feat: add gas station

* make code more readable

make code more readable

* update test

* Update gas_station.py

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

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

* tuple[GasStation, ...]

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

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

---------

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-05 15:18:54 +02:00
Kamil
9bfc314e87
hardy_ramanujanalgo type annotation (#9799)
* 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 type annotation.
2023-10-05 08:39:29 -04:00
Abul Hasan
f159a33506
convert to the base minus 2 of a number (#9748)
* Fix: Issue 9588

* Fix: Issue 9588

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

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

* Fix: Issue 9588

* Fix: Issue #9588

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

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

* Fix: Issue #9588

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

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

* Fix: Issue #9588

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

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

* fix: issue #9793

* fix: issue #9793

* fix: issue #9588

* [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-05 14:39:14 +02:00
Kamil
1b6c5cc271
Karatsuba type annotation (#9800)
* 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 type annotation.
2023-10-05 08:30:43 -04:00
Kamil
0e3ea3fbab
Fermat_little_theorem type annotation (#9794)
* 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 type annotation.

* Update fermat_little_theorem.py

Used other syntax.

* Update fermat_little_theorem.py

* Update maths/fermat_little_theorem.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-05 07:30:39 -04:00
Chris O
dffbe458c0
Update contributing guidelines to say not to open new issues for algorithms (#9760)
* updated CONTRIBUTING.md with markdown anchors and issues

* removed testing header from previous PR
2023-10-05 13:26:33 +02:00
Rohan Sardar
e29024d14a
Program to convert a given string to Pig Latin (#9712)
* Program to convert a given string to Pig Latin 

This is a program to convert a user given string to its respective Pig Latin form

As per wikipedia (link: https://en.wikipedia.org/wiki/Pig_Latin#Rules)
For words that begin with consonant sounds, all letters before the initial vowel are placed at the end of the word sequence. Then, "ay" is added, as in the following examples:
"pig" = "igpay"
"latin" = "atinlay"
"banana" = "ananabay"

When words begin with consonant clusters (multiple consonants that form one sound), the whole sound is added to the end when speaking or writing.
"friends" = "iendsfray"
"smile" = "ilesmay"
"string" = "ingstray"

For words that begin with vowel sounds, one just adds "hay", "way" or "yay" to the end. Examples are:
"eat" = "eatway"
"omelet" = "omeletway"
"are" = "areway"

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

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

* Update pig_latin.py

Added f-string

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

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

* Update pig_latin.py

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

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

* Update pig_latin.py

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

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

* Update pig_latin.py

* Update pig_latin.py

* Update pig_latin.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-05 10:52:40 +02:00
Naman
f3be0ae9e6
Added largest pow of 2 le num (#9374) 2023-10-05 21:37:23 +13:00
Vipin Karthic
0d324de7ab
Doctest Error Correction of mirror_formulae.py (#9782)
* 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

---------

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>
2023-10-05 09:48:15 +02:00
rtang09
4b6301d4ce
Fletcher 16 (#9775)
* Add files via upload

* Update fletcher16.py

* Update fletcher16.py

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

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

* Update fletcher16.py

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

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

* Update fletcher16.py

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

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

* Update fletcher16.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-05 08:12:08 +02:00
Vipin Karthic
935d1d3225
Added Mirror Formulae Equation (#9717)
* 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

---------

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-05 07:57:55 +02:00
Sanket Kittad
1fda96b704
Palindromic (#9288)
* added longest palindromic subsequence

* removed

* added longest palindromic subsequence

* added longest palindromic subsequence link

* added comments
2023-10-05 12:40:14 +13:00
Tauseef Hilal Tantary
2fd43c0f7f
[New Algorithm] - Bell Numbers (#9324)
* Add Bell Numbers

* Use descriptive variable names

* Add type hints

* Fix failing tests
2023-10-05 12:33:12 +13:00