Commit Graph

3086 Commits

Author SHA1 Message Date
Tauseef Hilal Tantary
2fd43c0f7f
[New Algorithm] - Bell Numbers (#9324)
* Add Bell Numbers

* Use descriptive variable names

* Add type hints

* Fix failing tests
2023-10-05 12:33:12 +13:00
Raghav
6a391d113d
Added Photoelectric effect equation (#9666)
* Added Photoelectric effect equation

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

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

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

* fixed doctest

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

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Rohan Anand <96521078+rohan472000@users.noreply.github.com>
2023-10-05 12:16:19 +13:00
piyush-poddar
26d650ec28
Moved relu.py from maths/ to neural_network/activation_functions (#9753)
* Moved file relu.py from maths/ to neural_network/activation_functions

* Renamed relu.py to rectified_linear_unit.py

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

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

* UPDATED rat_in_maze.py

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

* fixed whitespaces error,improved matrix visual.

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

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

* updated.

* Try

* updated

* updated

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-04 20:43:17 +02:00
Bama Charan Chhandogi
d5806258d4
add median of two sorted array (#9386)
* add median of two sorted array

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

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

* fix syntax

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

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

* fix syntax

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

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

* improve code

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

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

* add documentation

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

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

* update

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-04 20:18:59 +02:00
Bama Charan Chhandogi
922d6a88b3
add median of matrix (#9363)
* add median of matrix

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

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

* update

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

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

* fix formating

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

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

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-04 19:21:46 +02:00
halfhearted
d74349793b
Arunsiva003 patch 1 flatten tree (#9695)
* infix to prefix missing feature added

* infix to prefix missing feature added

* infix to prefix missing feature added

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

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

* infix to prefix missing feature added (comments)

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

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

* infix to prefix missing feature added (comments)

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

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

* newly updated infix_to_prefix

* newly updated infix_to_prefix_2

* newly updated infix_to_prefix_3

* from the beginning

* Created flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

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

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

* Update flatten_binarytree_to_linkedlist.py

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

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

* Update flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

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

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

* Update flatten_binarytree_to_linkedlist.py (space added)

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

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

* Update flatten_binarytree_to_linkedlist.py space added

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

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

* Update flatten_binarytree_to_linkedlist.py

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

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

* flatten binary tree to linked list - 1

* flatten binary tree to linked list final

* flatten binary tree to linked list final

* review updated

* Update flatten_binarytree_to_linkedlist.py

* Update .pre-commit-config.yaml

* Update flatten_binarytree_to_linkedlist.py

* Update flatten_binarytree_to_linkedlist.py

---------

Co-authored-by: ArunSiva <Arunsiva003@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-04 18:39:28 +02:00
Tianyi Zheng
dfdd78135d
Fix mypy errors in circular_linked_list.py and swap_nodes.py (#9707)
* updating DIRECTORY.md

* Fix mypy errors in circular_linked_list.py

* Fix mypy errors in swap_nodes.py

---------

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

* docs : improve comments

* docs : improved docs and tested on pre-commit

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

* docs : improve comments

* docs : improved docs and tested on pre-commit

* docs : modified comments

* Update circular_linked_list.py

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

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

* docs : improved

* Update data_structures/linked_list/circular_linked_list.py

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

* Update data_structures/linked_list/circular_linked_list.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update data_structures/linked_list/swap_nodes.py

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

* Update requirements.txt

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

* Update data_structures/linked_list/circular_linked_list.py

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

* Apply suggestions from code review

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

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

* Update circular_linked_list.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-04 11:25:26 +02:00
Raghav
24dbdd0b88
Update coulombs_law.py docs (#9667)
* Update coulombs_law.py

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

* Update physics/coulombs_law.py

---------

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

* Removed Output.txt

* Removed Output.txt

* Fixed build errors
2023-10-03 23:34:55 -04:00
Tan Kai Qun, Jeremy
8c23cc5117
Add typing (#9654)
Co-authored-by: Jeremy Tan <jeremytan@stripe.com>
2023-10-03 22:07:25 -04:00
Tan Kai Qun, Jeremy
a7133eca13
Add typing (#9652)
Co-authored-by: Jeremy Tan <jeremytan@stripe.com>
2023-10-03 22:06:52 -04:00
Tan Kai Qun, Jeremy
28f1e68f00
Add typing (#9651)
Co-authored-by: Jeremy Tan <jeremytan@stripe.com>
2023-10-03 22:05:47 -04:00
Tan Kai Qun, Jeremy
12431389e3
Add typing to topological_sort.py (#9650)
* Add typing

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

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

---------

Co-authored-by: Jeremy Tan <jeremytan@stripe.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-03 21:47:03 -04:00
Ayush Yadav
81661bd2d0
Update newtons_law_of_gravitation.py : Typo(Space Removed) (#9351) 2023-10-03 19:47:26 -04:00
Aasheesh
0a84b8f842
Changing Name of file and adding doctests in file. (#9513)
* Adding doctests and changing file name

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

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

* Update binary_multiplication.py

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

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

* Update binary_multiplication.py

* Changing comment and changing name function

* Changing comment and changing name function

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

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

* Update binary_multiplication.py

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

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

* Update binary_multiplication.py

* Update binary_multiplication.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-03 11:40:11 -04:00
dekomori_sanae09
b60a94b5b3
merge double_factorial (#9431)
* merge double_factorial

* fix ruff error

* fix merge issues

* change test case

* fix import error
2023-10-03 09:53:27 -04:00
Christian Clauss
e60779c202
Upgrade our Devcontainer to Python 3.12 on Debian bookworm (#9580) 2023-10-03 23:04:59 +13:00
Christian Clauss
da03c14d39
Fix accuracy in maclaurin_series on Python 3.12 (#9581) 2023-10-03 22:48:58 +13:00
Christian Clauss
0f4e51245f
Upgrade to Python 3.12 (#9576)
* DRAFT: GitHub Actions: Test on Python 3.12

Repeats #8777
* #8777 

Some of our dependencies will not be ready yet.

* Python 3.12: Disable qiskit and tensorflow algorithms

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-03 14:47:10 +05:30
Christian Clauss
f964dcbf2f
pre-commit autoupdate && pre-commit run --all-files (#9516)
* pre-commit autoupdate && pre-commit run --all-files

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-03 05:05:43 +02:00
aryan1165
f8fe8fe41f
Removed maths/miller_rabin.py , Double implementation. #8098 (#9228)
* Removed ciphers/rabin_miller.py as it is already there maths/miller_rabin.py

* Renamed miller_rabin.py to rabain_miller.py

* Restore ciphers/rabin_miller.py and removed maths/rabin_miller.py
2023-10-03 10:57:00 +13:00
Varshaa Shetty
8c7bd1c48d
Deleted minmax.py (#9482) 2023-10-03 10:47:10 +13:00
Saksham Chawla
95345f6f5b
Add typng to binomial_coefficient.py (#9480) 2023-10-02 11:21:45 -04:00
Saksham Chawla
73118b9f67
Add typing to binary_exponentiation_3.py (#9477) 2023-10-02 10:41:34 -04:00
Saksham Chawla
97154cfa35
Add typing to binary_exp_mod.py (#9469)
* Add typing to  binary_exp_mod.py

* Update binary_exp_mod.py

* review changes
2023-10-02 10:30:34 -04:00
Saksham Chawla
89a65a8617
Add typing to binary_exponentiation.py (#9471)
* Add typing to binary_exponentiation.py

* Update binary_exponentiation.py

* float to int division change as per review
2023-10-02 10:29:06 -04:00
Saksham Chawla
9640a4041a
Add typing to binary_exponentiation_2.py (#9475) 2023-10-02 10:28:36 -04:00
Bama Charan Chhandogi
e798e5acde
add reverse k group linkedlist (#9323)
* add reverse k group linkedlist

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

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

* update

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

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

* update

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

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

* update

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

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

* update

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

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

* update

* Update reverse_k_group.py

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

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

* Update reverse_k_group.py

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

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

* Update reverse_k_group.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-02 02:19:39 +02:00
Dhruv Manilawala
24e7edbe5b
Remove myself from CODEOWNERS (#9325) 2023-10-01 23:18:16 +02:00
Kamil
8d94f7745f
Euler072 - application of vector operations to reduce calculation time and refactoring numpy (#9229)
* 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.

* Application of vector operations  to reduce calculation time and refactoring numpy.

* [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-01 14:14:58 -04:00
aryan1165
18cdbc4165
binary_search_traversals.py made memory-friendly using generators. Fixes #8725 completely. (#9237)
* Made binary tree memory-friendly using generators based travels. Fixes
#8725

* Made binary tree memory-friendly using generators based travels. Fixes
#8725

* Fixed pre-commit errors
2023-10-01 12:54:05 -04:00
Muhammad Umer Farooq
bacad12a1f
[NEW ALGORITHM] Rotate linked list by K. (#9278)
* Rotate linked list by k.

* Rotate linked list by k.

* updated variable name.

* Update data_structures/linked_list/rotate_linked_list_by_k.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 data_structures/linked_list/rotate_linked_list_by_k.py

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

* Update data_structures/linked_list/rotate_linked_list_by_k.py

* Make Node a dataclass

---------

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-01 18:11:16 +02:00
Bama Charan Chhandogi
43c3f4ea40
add Three sum (#9177)
* add Three sum

* add Three sum

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

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

* update

* update

* update

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

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

* update

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

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

* add documention

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-01 16:46:12 +02:00
Christian Clauss
596d934238
Fix ruff warning (#9272) 2023-10-01 17:28:30 +05:30
Shreya Bhalgat
cfabd91a8b
Add missing number algorithm (#9203)
* Added missing_number algorithm using bit manipulation

* Update bit_manipulation/missing_number.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-01 13:28:20 +02:00
aryan1165
eaa87bd791
Made binary tree memory-friendly using generators based travels. Fixes (#9208)
#8725
2023-10-01 04:43:48 -04:00
aryan1165
fbbbd5db05
Deleted add.py. As stated in #6216 (#9180) 2023-10-01 01:34:03 -04:00
aryan1165
3dbafd3f0d
Deleted random_normal_distribution_quicksort.py. Fixes #9124 (#9182) 2023-10-01 01:21:46 -04:00
aryan1165
832610ab1d
Deleted sorts/random_pivot_quick_sort.py (#9178) 2023-10-01 00:40:53 -04:00
Tianyi Zheng
280dfc1a22
Fix DeprecationWarning in local_weighted_learning.py (Attempt 2) (#9170)
* Fix DeprecationWarning in local_weighted_learning.py

Fix DeprecationWarning that occurs during build due to converting an
np.ndarray to a scalar implicitly

* DeprecationWarning fix attempt 2
2023-10-01 17:07:25 +13:00
aryan1165
320d895b86
Fixed permute_recursive() by passing nums.copy(). Fixes #9014 (#9161)
* Fixes #9014

* Fixed permute_recursive() by passing nums.copy()
2023-10-01 00:06:15 -04:00
Tianyi Zheng
5f8d1cb5c9
Fix DeprecationWarning in local_weighted_learning.py (#9165)
Fix DeprecationWarning that occurs during build due to converting an
np.ndarray to a scalar implicitly
2023-10-01 16:31:35 +13:00
Tianyi Zheng
aaf7195465
Fix mypy error in web_programming/reddit.py (#9162)
* updating DIRECTORY.md

* updating DIRECTORY.md

* Fix mypy error in web_programming/reddit.py

web_programming/reddit.py:36: error: Missing named argument "response" for "HTTPError"  [call-arg]

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-01 16:10:33 +13:00
Caeden Perelli-Harris
dec96438be
Create word search algorithm (#8906)
* feat(other): Create word_search algorithm

* updating DIRECTORY.md

* doc(word_search): Link to wikipedia article

* Apply suggestions from code review

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

* Update word_search.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-30 00:57:56 -04:00
Belhadj Ahmed Walid
467903aa33
added smith waterman algorithm (#9001)
* added smith waterman algorithm

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

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

* descriptive names for the parameters a and b

* doctesting lowercase upcase empty string cases

* updated block quot,fixed traceback and doctests

* shorter block quote

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

* global vars to func params,more doctests

* updated doctests

* user access to SW params

* formating

---------

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-09-30 00:33:13 -04:00
Hetarth Jain
35dd529c85
Returning Index instead of boolean in knuth_morris_pratt (kmp) function, making it compatible with str.find(). (#9083)
* Update knuth_morris_pratt.py - changed Boolean to Index

* Update knuth_morris_pratt.py

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

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

* Update knuth_morris_pratt.py

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

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

* Update knuth_morris_pratt.py

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

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

* Update back_propagation_neural_network.py

* Update back_propagation_neural_network.py

* Update strings/knuth_morris_pratt.py

* Update knuth_morris_pratt.py

* Update knuth_morris_pratt.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-09-28 20:24:46 +02:00
aryan1165
38c2b83981
Deleted euclidean_gcd.py. Fixes#8063 (#9108) 2023-09-27 15:56:01 +02:00
Tianyi Zheng
f9b8759ba8
Move bitwise add (#9097)
* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Move and rename maths/sum_of_two_positive_numbers_bitwise.py

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-09-27 15:54:40 +02:00