Commit Graph

3424 Commits

Author SHA1 Message Date
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
Raghav
6a391d113d
Added Photoelectric effect equation (#9666)
* Added Photoelectric effect equation

Photoelectric effect is one of the demonstration of quanta of energy.

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

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

* fixed doctest

Co-authored-by: Rohan Anand <96521078+rohan472000@users.noreply.github.com>

* [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: Rohan Anand <96521078+rohan472000@users.noreply.github.com>
2023-10-05 12:16:19 +13:00
piyush-poddar
26d650ec28
Moved relu.py from maths/ to neural_network/activation_functions (#9753)
* Moved file relu.py from maths/ to neural_network/activation_functions

* Renamed relu.py to rectified_linear_unit.py

* Renamed relu.py to rectified_linear_unit.py in DIRECTORY.md
2023-10-04 16:28:19 -04:00
Muhammad Umer Farooq
c16d2f8865
UPDATED rat_in_maze.py (#9148)
* UPDATED rat_in_maze.py

* Update reddit.py in Webprogramming b/c it was causing error in pre-commit tests while raising PR.

* UPDATED rat_in_maze.py

* fixed return type to only maze,otherwise raise valueError.

* fixed whitespaces error,improved matrix visual.

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

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

* updated.

* Try

* updated

* updated

* Apply suggestions from code review

---------

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-04 20:43:17 +02:00
Bama Charan Chhandogi
d5806258d4
add median of two sorted array (#9386)
* add median of two sorted array

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

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

* fix syntax

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

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

* fix syntax

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

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

* improve code

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

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

* add documentation

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

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

* update

* [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-04 20:18:59 +02:00
Bama Charan Chhandogi
922d6a88b3
add median of matrix (#9363)
* add median of matrix

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

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

* update

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

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

* fix formating

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

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

* Apply suggestions from code review

---------

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-04 19:21:46 +02:00
halfhearted
d74349793b
Arunsiva003 patch 1 flatten tree (#9695)
* infix to prefix missing feature added

* infix to prefix missing feature added

* infix to prefix missing feature added

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

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

* infix to prefix missing feature added (comments)

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

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

* infix to prefix missing feature added (comments)

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

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

* newly updated infix_to_prefix

* newly updated infix_to_prefix_2

* newly updated infix_to_prefix_3

* from the beginning

* Created flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

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

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

* Update flatten_binarytree_to_linkedlist.py

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

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

* Update flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

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

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

* Update flatten_binarytree_to_linkedlist.py (space added)

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

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

* Update flatten_binarytree_to_linkedlist.py space added

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

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

* Update flatten_binarytree_to_linkedlist.py

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

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

* flatten binary tree to linked list - 1

* flatten binary tree to linked list final

* flatten binary tree to linked list final

* review updated

* Update flatten_binarytree_to_linkedlist.py

* Update .pre-commit-config.yaml

* Update flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

---------

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>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-04 18:39:28 +02:00
Tianyi Zheng
dfdd78135d
Fix mypy errors in circular_linked_list.py and swap_nodes.py (#9707)
* updating DIRECTORY.md

* Fix mypy errors in circular_linked_list.py

* Fix mypy errors in swap_nodes.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-04 18:05:00 +02:00
Siddhant Totade
3fd3497f15
Add Comments (#9668)
* docs : add comment in circular_linked_list.py and swap_nodes.py

* docs : improve comments

* docs : improved docs and tested on pre-commit

* docs : add comment in circular_linked_list.py and swap_nodes.py

* docs : improve comments

* docs : improved docs and tested on pre-commit

* docs : modified comments

* Update circular_linked_list.py

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

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

* docs : improved

* Update data_structures/linked_list/circular_linked_list.py

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

* Update data_structures/linked_list/circular_linked_list.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update requirements.txt

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

* Update data_structures/linked_list/circular_linked_list.py

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

* Apply suggestions from code review

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

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

* Update circular_linked_list.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-04 11:25:26 +02:00
Raghav
24dbdd0b88
Update coulombs_law.py docs (#9667)
* Update coulombs_law.py

distance is positive non zero real number (float type) hence corrected docs which says only integer.

* Update physics/coulombs_law.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-04 02:08:13 -04:00
aryan1165
700df39ad4
Fixed file name in transposition_cipher_encrypt_decrypt_file.py. Fixing bug file not found. (#9426)
* Fixed file name in trnasposition_cipher_encrypt_decrypt_file.py

* Removed Output.txt

* Removed Output.txt

* Fixed build errors
2023-10-03 23:34:55 -04:00
Tan Kai Qun, Jeremy
8c23cc5117
Add typing (#9654)
Co-authored-by: Jeremy Tan <jeremytan@stripe.com>
2023-10-03 22:07:25 -04:00