* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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
* 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>
* 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>
* 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>
* fix the edge case of the double ended queue pop the last element
* refactoring doc
---------
Co-authored-by: Jiang15 <weijiang@weijiangs-MacBook-Pro.local>
* 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>
* 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.
* 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>
* 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.
* 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>
* 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>
* 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>