* neha3423
* neha3423
* neha3423
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha3423
* neha3423
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha323
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha3423
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha3423
* neha3423
* neha3423
* neha3423
* Added test case for tuple
* Update kth_largest_element.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 Lens formulae to the Physics repository
* Resolved the commented issues
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update lens_formulae.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>
* added mean absolute error to loss_functions.py
* added doctest to mean absolute error to loss_functions.py
* fixed long line in loss_functions.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed error in MAE
* Update machine_learning/loss_functions.py
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.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>
* Add error tests in doctest and fix error message
* Change AssertationError to ValueError
* [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 mean absolute percentage error
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added mean_absolute_percentage_error
* added mean_absolute_percentage_error
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added mean_absolute_percentage_error
* added mean_absolute_percentage_error
* added mean absolute percentage error
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added mean absolute percentage error
* added mean absolute percentage error
* added mean absolute percentage error
* added mean absolute percentage error
* added mean absolute percentage error
* Update machine_learning/loss_functions.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>
* Code Enhancements in merge_sort.py
This enhanced code includes improved variable naming, error handling for user input, and more detailed docstrings. It's now more robust and readable.
* [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>
* Improved Equilibrium Index of an Array.
This is the modifications made to the original code:
1. Create Doctest Instructions: Python "doctest" can be executed by running the following command: python -m doctest -v equilibrium_index.py.
2. Deleted Argument {size}: Deleted the `size` argument because `len(arr)} allows the array's length to be determined inside the function, simplifying and improving the readability of the function signature.
3. Used {enumerate}: To improve code readability and indicate that we're working with element-index pairs, we iterated through the array using both elements and their indices using the `enumerate` function.
4. Optimized the Loop: To prevent pointless additions, the loop was improved by initializing {left_sum} with the value of the first element (arr[0]). Furthermore, since the beginning and last items (0 and size - 1) cannot be equilibrium indices, there is no need to check them, saving further computations.
* [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>
* Code enhancements in binary_insertion_sort.py
* [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>
* Add function docstrings, comments and type hints
* Fix type mismatch
* Fix type hint error
* Fix float to int error
* Update ford_fulkerson.py
* Update ford_fulkerson.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update ford_fulkerson.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>
* Tried new TESTS for the binomial_coefficient
* Fix the tests request
* Update binomial_coefficient.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update binomial_coefficient.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>
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update current_weather.py
* Update current_weather.py
* Update current_weather.py
* Update current_weather.py
* import requests
---------
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 `Invert a Binary Tree` solution
* Add type
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add `doctest`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add `test` to `get_tree_inorder`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add `test` changes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix lint errors
* Fix precommit errors
* Update and rename invert_binary_tree.py to mirror_binary_tree.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 New Algorithm: Triangular Numbers
* Calculate nth triangular number instead of generating a list
* Handle 0th position and update function name and docstring
* Add Simple Moving Average (SMA) Calculation
This commit adds a Python script for calculating the Simple Moving Average (SMA) of a time series data.
The script also includes a doctest that verifies the correctness of the SMA calculations for a sample dataset.
Usage:
- Run the script with your own time series data and specify the window size for SMA calculations.
* Update financial/simple_moving_average.py
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* Update financial/simple_moving_average.py
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* Update financial/simple_moving_average.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
* Update simple_moving_average.py
* Update financial/simple_moving_average.py
* Update simple_moving_average.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* don't need to return list because list is mutable
* Don't need to return list as list is mutable
* use advantage of python in swapping
* filter blank inputs from input list
* minor changes
* minor mistake
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* more readable
* Update double_sort.py
* last fixes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply suggestions from code review
* [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>
* Remove eval from arithmetic_analysis/newton_raphson.py
* Relocate contents of arithmetic_analysis/
Delete the arithmetic_analysis/ directory and relocate its files because
the purpose of the directory was always ill-defined. "Arithmetic
analysis" isn't a field of math, and the directory's files contained
algorithms for linear algebra, numerical analysis, and physics.
Relocated the directory's linear algebra algorithms to linear_algebra/,
its numerical analysis algorithms to a new subdirectory called
maths/numerical_analysis/, and its single physics algorithm to physics/.
* updating DIRECTORY.md
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Add perfect cube binary search algorithm
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add support for testing negative perfect cubes
* Add TypeError check for invalid inputs
* [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 the algorithm to compute the terminal velocity of an object falling in a fluid
* fixed spelling mistake
* fixed issues in topic description
* imported the value of g from scipy and changed the doctests accordingly
* fixed formatting
* Apply suggestions from code review
---------
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* Added Binary Focal Cross Entropy
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed Issue
* Fixed Issue
* Added BFCE loss to loss_functions.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update machine_learning/loss_functions.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>
* added doctest to playfair_cipher.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added newline to EOF andremoved trailing whitespace
* [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: Keyboard-1 <142900182+Keyboard-1@users.noreply.github.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>
* Enhance readability of N Queens
* Simplify is_safe code
* [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: Tianyi Zheng <tianyizheng02@gmail.com>
* Add: Time Conversion Function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update conversions/time_conversions.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* fix: required changes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: err
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update time_conversions.py
---------
Co-authored-by: Jeel Gajera <jeelgajera00@gmail.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 other possible cases
* added test for correct output of truth table
* updating DIRECTORY.md
* Update nor_gate.py
---------
Co-authored-by: = <=>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Contributes to #9943
Added doctest to largest_of_very_large_numbers.py
Added doctest to word_patterns.py
Added doctest to onepad_cipher.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Contributes to #9943
Added doctest to maths/largest_of_very_large_numbers.py
Added doctest to strings/word_patterns.py
Added doctest to ciphers/onepad_cipher.py
* Add tests without modifying code #10740
Added test to maths/largest_of_very_large_numbers
Added test to strings/word_patterns.py
Added test to ciphers/onepad_cipher.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* adding new physics algorithm: center of mass
* Add changes requested by the reviewer
* Add changes requested by the reviewer
* Update center_of_mass.py
* Update center_of_mass.py
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added doctests to the swap_nodes file under linkedlist data structure
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added doctests to the swap_nodes file under linkedlist data structure
* Added doctests to the swap_nodes file under linkedlist data structure
* Added doctests to the swap_nodes file under linkedlist data structure
* Update swap_nodes.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>
* avg and mps speed formulae added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* avg and mps speed formulae added
* fixed_spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ws
* added amicable numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added amicable numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed
* changed name of file and added code improvements
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* issues fixed due to pi
* requested changes added
* Created doppler_effect_of_sound.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated doppler_effect_of_sound.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added desc names
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* renamed doppler_effect_of_sound.py to doppler_frequency.py
* used expection handling rather than print statements
* fixed spacing for ruff
* Update doppler_frequency.py
This is super slick! Well done.
---------
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 new tests!
* [ADD]: Inproved Tests
* fixed
* Removed spaces
* Changed the file name
* Added Changes
* changed the code and kept the test cases
* changed the code and kept the test cases
* missed the line
* removed spaces
* Update power_using_recursion.py
* Added new tests in Signum
* Few things added
* Removed few stuff and added few changes
* Fixed few things
* Reverted the function
* Update maths/signum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added few things
* Update maths/signum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added the type hint back
* Update signum.py
* Added NEW tests for Perfect_Number
* Update maths/special_numbers/perfect_number.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added the line back
* Update maths/special_numbers/perfect_number.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fixed a space
* Updated
* Reverted changes
* Added the old code and FIXED few LINES
* Fixed few things
* Changed Test CASES
* Update perfect_number.py
* [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>
* add exponential_search algorithm
* replace binary_search with binary_search_recursion
* convert left type to int to be useable in binary_search_recursion
* add docs and tests for exponential_search algorithm
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* move exponential_search to binary_search.py to pass github auto build tests
delete exponential_search.py file
* Update searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* remove additional space searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* return single data type in exponential_search searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* add doctest mod searches/binary_search.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
* use // instread of int() convert searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* change test according to new code searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* fix binary_search_recursion multiple type return error
* add a timeit benchmark for exponential_search
* sort input of binary search to be equal in performance test with exponential_search
* raise value error instead of sorting input in binary and exonential search to fix bugs
* Update binary_search.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: user <user@kali.user>
* Add: FP Growth Algorithm
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* changes names
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert "changes names"
This reverts commit c0470094d0.
* refactore code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update frequent_pattern_growth.py
---------
Co-authored-by: Jeel Gajera <jeelgajera00@gmail.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>