Commit Graph

3426 Commits

Author SHA1 Message Date
Berat Osman Demiralay
d051db1f14
Add Simple Moving Average (SMA) Calculation (#9300)
* 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>
2023-10-23 09:25:07 -04:00
Krishna-singhal
417b7edfc3
code enhancement in sort.double_sort (#10798)
* 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>
2023-10-23 09:51:27 +02:00
Tianyi Zheng
a8b6bda993
Delete arithmetic_analysis/ directory and relocate its contents (#10824)
* 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>
2023-10-23 09:31:30 +02:00
Dale Dai
a9cee1d933
Add perfect cube binary search (#10477)
* 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>
2023-10-23 01:56:59 -04:00
Paarth Goyal
abc390967d
Added the algorithm to compute the terminal velocity of an object fal… (#10237)
* 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>
2023-10-23 01:43:30 -04:00
Pratik Tripathy
68faebe711
feat: Add mass energy equivalence in physics and doctests (#10202)
* updating DIRECTORY.md

* feat: Add mass energy equivalence in physics

* updating DIRECTORY.md

* updating DIRECTORY.md

* Apply suggestions from code review

* Update physics/mass_energy_equivalence.py

* Update mass_energy_equivalence.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-23 01:35:10 -04:00
Suyash Dongre
dc4e89805a
Added docstring/documentation for sigmoid_function (#10756)
* Added doctest for sigmoid_function

* Added doctest for sigmoid_function

* Added doctest for sigmoid_function
2023-10-23 01:27:33 -04:00
Ankit Avinash
abd6bca074
Added Binary Focal Cross Entropy (#10674)
* 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>
2023-10-23 01:24:51 -04:00
Anshu Sharma
fdb0635c71
added doctest to playfair_cipher.py (#10823)
* 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>
2023-10-22 17:39:31 -04:00
Hardik Pawar
a8b94abc8b
Enhance readability of N Queens (#9265)
* 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>
2023-10-22 14:51:56 -04:00
Jeel Gajera
6c8743f1e6
Add: Time Conversion Function (#10749)
* 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>
2023-10-22 15:51:30 +02:00
Kento
7d0f6e012a
Updated doctests for nor_gate (#10791)
* 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>
2023-10-22 11:08:08 +02:00
gio-puter
0601b56173
Add tests without modifying code (#10740)
* 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>
2023-10-22 07:42:26 +02:00
santiditomas
d73a4c2ee0
adding new physics algorithm: center of mass (#10743)
* 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>
2023-10-22 01:59:41 +02:00
Precious C. Jacob
c92e86bd79
Add tests to data_structures/linked_list/swap_nodes.py (#10751)
* 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>
2023-10-22 01:33:49 +02:00
Barun Parua
d9562033f6
added a function to calculate perceived frequency by observer using Doppler Effect (#10776)
* 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>
2023-10-22 00:33:50 +02:00
Saptadeep Banerjee
4707fdb0f2
Add tests for Perfect_Number (#10745)
* 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>
2023-10-22 00:05:37 +02:00
Kiarash Hajian
b814cf3781
add exponential search algorithm (#10732)
* 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>
2023-10-21 20:53:34 +02:00
Tianyi Zheng
06edc0eea0
Consolidate binary exponentiation files (#10742)
* Consolidate binary exponentiation files

* updating DIRECTORY.md

* Fix typos in doctests

* Add suggestions from code review

* Fix timeit benchmarks

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-21 13:27:36 -04:00
Jeel Gajera
47c19d9b2d
Add: FP Growth Algorithm (#10746)
* 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>
2023-10-21 16:51:29 +02:00
Tianyi Zheng
5645084dcd
Consolidate loss functions into a single file (#10737)
* Consolidate loss functions into single file

* updating DIRECTORY.md

* Fix typo

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-20 23:29:42 +02:00
Ope Oluwaferanmi
52a987ea2f
Add docstrings and doctests and fix a bug ciphers/trifid_cipher.py (#10716)
* Added docstrings,doctests and fixed a bug

* Added docstrings,doctests and fixed a bug

* Added docstrings,doctests and fixed a bug

* Added docstrings and doctests with a bug fix

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

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

* Added docstrings and doctests with a bug fix

* Update ciphers/trifid_cipher.py

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

* Update ciphers/trifid_cipher.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

* Docstrings edit

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

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

* Update trifid_cipher.py

* Update pyproject.toml

---------

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-20 23:28:21 +02:00
Saptadeep Banerjee
579937613a
Added New Tests in Signum (#10724)
* 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

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-20 13:02:30 +02:00
Tianyi Zheng
ce0ede6476
Fix typo in DPLL file name (#10723)
* Fix DPLL file name

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-20 09:08:23 +02:00
Tianyi Zheng
6f2d6f72d5
Move files for special numbers to own directory (#10714) 2023-10-20 08:17:31 +02:00
shivaparihar6119
197604898b
Concatenates both check bipatrite graphs(bfs&dfs) (#10708)
* sync

* fixes#8098

* deleted:    graphs/check_bipartite_graph_all.py
	new file:   graphs/check_bipatrite,py

* renamed:    graphs/check_bipatrite,py -> graphs/check_bipatrite.py

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

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

* Add the new tests

---------

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-20 08:09:58 +02:00
RaymondDashWu
82fc24ce96
Test cases for check_bipartite_graph_bfs (#10688)
* [ADD] tests for check_bipartite_graph_bfs

* linter fix?

* linter fix

* [ADD] more test cases check_bipartite_graph_bfs

* doctest fixes. Forgot to add 'Traceback...'

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

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

* missed a Traceback

* Update check_bipartite_graph_bfs.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-20 06:42:20 +02:00
Saptadeep Banerjee
4154428351
[ADD]: Improved tests in power recursion! (#10664)
* 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

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-20 06:29:24 +02:00
Tianyi Zheng
51805338af
Fix ruff error in machine_learning/sequential_minimum_optimization.py (#10717)
* updating DIRECTORY.md

* Try to fix ruff error in sequential_minimum_optimization.py

* Update sequential_minimum_optimization.py

* Update sequential_minimum_optimization.py

* Update sequential_minimum_optimization.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-20 05:35:38 +02:00
Adam Ross
9875f374f4
Consolidate bubble sort iterative and recursive (#10651)
* Consolidate bubble sort iterative and recursive

* Update sorts/bubble_sort.py

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

* Refactor bubble sort func signature, doctest, timer

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

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

* Update bubble_sort.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-19 22:45:51 +02:00
Anupamaraie
34f48b684b
Create vernam_cipher.py (#10702)
* Create vernam_cipher.py

added vernam cipher

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

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

* Update vernam_cipher.py

added return type

* Update vernam_cipher.py

added type hint for plaintext and key

* Update vernam_cipher.py

added tests

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

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

* Update vernam_cipher.py

Added tests

* Update vernam_cipher.py

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

* Update vernam_cipher.py

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

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

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

* Update vernam_cipher.py

* Update ciphers/vernam_cipher.py

* Update vernam_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-19 22:05:16 +02:00
NikhithaBandari
be94690dec
Create swap_all_odd_and_even_bits.py (#10692)
* Create swap_all_odd_and_even_bits.py

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

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

* Update swap_all_odd_and_even_bits.py

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

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

* 6: 00000110 --> 9: 00001001

* Update swap_all_odd_and_even_bits.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>
2023-10-19 19:49:47 +02:00
Christian Clauss
26ffad9d17
Simplify is_bst.py (#10627)
* Simplify is_bst.py

* updating DIRECTORY.md

* Update is_bst.py

* Rename is_bst.py to is_sorted.py

* updating DIRECTORY.md

* Update data_structures/binary_tree/is_sorted.py

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

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-19 13:31:51 -04:00
ketan96-m
6987614067
*added docstring and doctest for find_isolated_nodes (#10684)
*added docstring and doctest for edglist

*added docstring and doctest for adjm

Co-authored-by: Ketan <ketanbmahajan@gmail.com>
2023-10-19 16:48:53 +02:00
Ankit Avinash
bd3072b845
Added Mean Squared Logarithmic Error (MSLE) Loss Function (#10637)
* Added Mean Squared Logarithmic Error (MSLE)

* Added Mean Squared Logarithmic Error (MSLE)

* [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-19 10:46:39 -04:00
Abílio Azevedo
289a4dd6d3
docs: add test scenarios to pull request template (#10396)
* docs: add test scenarios to pull request template

* Update .github/pull_request_template.md

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-19 16:35:41 +02:00
anshul-2010
33888646af
Edit Distance Algorithm for String Matching (#10571)
* Edit Distance Algorithm for String Matching

* [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

* Update edit_distance.py

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-19 08:38:02 -04:00
Iyiola Aloko
b301e589e2
Update binary_exponentiation.py (#10342)
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-19 08:21:48 -04:00
rtang09
30c8d5573a
Update binary_exponentiation.py (#10253)
* Update binary_exponentiation.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>
2023-10-19 08:15:23 -04:00
rtang09
9adb7ced16
Update primelib.py (#10209)
* 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>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-19 08:02:04 -04:00
Shivansh Bhatnagar
572de4f15e
Added A General Swish Activation Function inNeural Networks (#10415)
* Added A General Swish Activation Function inNeural Networks

* Added the general swish function in the SiLU function and renamed it as swish.py

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

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

---------

Co-authored-by: Shivansh Bhatnagar <shivansh.bhatnagar.mat22@iitbhu.ac.in>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-18 10:50:18 -04:00
Poojan Smart
361f64c21d
Adds hinge loss function algorithm (#10628)
* Adds exponential moving average algorithm

* code clean up

* spell correction

* Modifies I/O types of function

* Replaces generator function

* Resolved mypy type error

* readibility of code and documentation

* Update exponential_moving_average.py

* Adds hinge loss function

* suggested doc and refactoring changes

* refactoring

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-18 10:09:13 -04:00
Jai Vignesh J
788e4ede9b
Fix doctest power recursion (#10659)
* Added doctests to power_using_recursion.py

* Added doctest to power_using_recursion.py

* Update power_using_recursion.py

* Update power_using_recursion.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-18 00:50:57 +02:00
Manmita Das
9da6f48b46
Add binary_coded_decimal.py (#10656)
* added decimal to bcd sequence

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

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

* updated with fixes

* Update and rename bcd_sequence.py to binary_coded_decimal.py

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

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

* Update binary_coded_decimal.py

* Update binary_coded_decimal.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>
2023-10-18 00:37:57 +02:00
Marek Mazij
9de1c49fe1
feat: Polish ID (PESEL) checker added (#10618)
* feat: Polish ID (PESEL) checker added

* refactor: 'sum' variable renamed to 'subtotal'

* style: typos

* 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: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-17 20:24:16 +02:00
Anubhavpandey27
09c2b2d006
Add arrays/sudoku_solver.py (#10623)
* Create Sudoku_Solver

Each of the digits 1-9 must occur exactly once in each row.
Each of the digits 1-9 must occur exactly once in each column.
Each of the digits 1-9 must occur exactly once in each of the 9 3x3 sub-boxes of the grid.
The '.' character indicates empty cells.

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

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

* Rename Sudoku_Solver to sudoku_solver.py

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

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

* Update sudoku_solver.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>
2023-10-17 19:07:40 +02:00
RaymondDashWu
72bd653e04
Test cases for all_combinations (#10633)
* [ADD] Test cases for all_combinations

* [DEL] documentation reverted b/c redundant

* Update all_combinations.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-17 16:57:33 +02:00
ojas wani
ac3bd1032c
Add matrix_multiplication (#10045)
* 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

* add matrix_multiplication.py

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

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

* update matrix_multiplication

* update matrix_multiplication

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

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

* make changes

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

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

* update

* update

* updates

* resolve conflict

* add doctest

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

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

* make changes

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

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

* update laplacian.py

* add doctests

* more doctest added

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

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

* try to resolve ruff error

* try to reslve ruff error

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

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

* update doctest

* attemp - resolve ruff error

* resolve build error

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

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

* resolve build issue

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

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

* update build

* doctest update

* update doctest

* update doctest

* update doctest

* fix ruff error

* file location changed

* Delete digital_image_processing/filters/laplacian_filter.py

* Create laplacian_filter.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.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-17 11:25:25 +02:00
Kushagra Agarwal
c6c3bd3399
Hacktoberfest: Added Octal Number to Hexadecimal Number Conversion Algorithm (#10533)
* Added Octal to Hexadecimal Conversion program under 'conversions' directory

* Update conversions/octal_to_hexadecimal.py

fix: minor improvement to directly return hexadecimal value

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

* Update conversions/octal_to_hexadecimal.py

fix: improvement updates to octal to hexadecimal

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

* Update conversions/octal_to_hexadecimal.py

fix: Readablility improvements to octal to hexadecimal convertor

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

* Update conversions/octal_to_hexadecimal.py

fix: readability improvements in octal_to_hexadecimal.py

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

* Update conversions/octal_to_hexadecimal.py

fix: readability improvements in octal_to_hexadecimal.py

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

* fix: Fixed all the errors in octal_to_hexadecimal.py after commiting suggested changes

* fix: modified the prefix of hex numbers to the '0x' standard in octal_to_hexadecimal.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-17 03:10:24 -04:00
Saurabh Mahapatra
00165a5fb2
Added test cases to join.py (#10629)
* Added test cases to join.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>
2023-10-17 02:36:12 -04:00