* 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>
* 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>
* 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>
* 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>
* 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(
* 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>
* 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>
* 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
* added the algorithm to compute Reynolds number
* fixed file name issue
* Apply suggestions from code review
---------
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* 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>
* 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>
* 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.
* 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>
* 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>
* 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>
* 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>
* 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>