Commit Graph

3073 Commits

Author SHA1 Message Date
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
Tianyi Zheng
76767d2f09
Consolidate the two existing kNN implementations (#8903)
* Add type hints to k_nearest_neighbours.py

* Refactor k_nearest_neighbours.py into class

* Add documentation to k_nearest_neighbours.py

* Use heap-based priority queue for k_nearest_neighbours.py

* Delete knn_sklearn.py

* updating DIRECTORY.md

* Use optional args in k_nearest_neighbours.py for demo purposes

* Fix wrong function arg in k_nearest_neighbours.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-09-27 14:01:18 +02:00
Tianyi Zheng
5830b29e7e
Fix mypy errors in erosion_operation.py (#8603)
* updating DIRECTORY.md

* Fix mypy errors in erosion_operation.py

* Rename functions to use snake case

* updating DIRECTORY.md

* updating DIRECTORY.md

* Replace raw file string with pathlib Path

* Fix function name in erosion_operation.py doctest

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-09-27 14:00:34 +02:00
thor-harsh
84ec9414e4
Update k_means_clust.py (#8996)
* Update k_means_clust.py

* Apply suggestions from code review

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-27 02:31:42 -04:00
Okza Pradhana
b2e186f4b7
feat(maths): add function to perform calculation (#6602)
* feat(maths): add function to perform calculation
- Add single function to calculate sum of two positive numbers
  using bitwise operator

* docs: add wikipedia url as explanation

* [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: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update sum_of_two_positive_numbers_bitwise.py

* Update sum_of_two_positive_numbers_bitwise.py

* Update sum_of_two_positive_numbers_bitwise.py

---------

Co-authored-by: Okza Pradhana <okzapradhana@azko-macbook.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2023-09-27 02:06:19 -04:00
gudlu1925
eace4cea32
Added Coulomb_Law (#8714)
* Create coulomb_law.py

* Update coulomb_law.py

* Update coulomb_law.py

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

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

* Update and rename coulomb_law.py to coulombs_law.py

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

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

* Update coulombs_law.py

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

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

* Update coulombs_law.py

* Update coulombs_law.py

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

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

* Update coulombs_law.py

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

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

* Update coulombs_law.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-09-27 01:44:06 -04:00
Amir Lavasani
211247ef82
Add MFCC Feature Extraction Algorithm (#9057)
* Add MFCC feature extraction to machine learning

* Add standalone usage in comments

* Apply suggestions from code review

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

* Delete empty junk file (#9062)

* updating DIRECTORY.md

* updating DIRECTORY.md

* Delete empty junk file

* updating DIRECTORY.md

* Fix ruff errors

* Fix more ruff errors

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>

* [main] Fix typo due to auto review change

* Add doctests for all functions

* Add MFCC feature extraction to machine learning

* Add standalone usage in comments

* Apply suggestions from code review

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

* [main] Fix typo due to auto review change

* Add doctests for all functions

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

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

* Fix some pre-commit issues

* Update review issues
* Remove types from docstring
* Rename dct
* Add mfcc docstring
* Add typing to several functions

* Apply suggestions from code review

* Update mfcc.py

* get_filter_points() -> tuple[np.ndarray, np.ndarray]:

* algorithm

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-24 23:08:51 +02:00
Chris O
882fb2f3c9
Rewrite of base85.py algorithm (#9069)
* rewrite of base85.py

* changed maps to list comprehension

* Apply suggestions from code review

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

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-24 03:36:06 -04:00
pre-commit-ci[bot]
708d906141
[pre-commit.ci] pre-commit autoupdate (#9067)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.288 → v0.0.290](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.288...v0.0.290)

* Update .pre-commit-config.yaml

---------

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-24 12:04:47 +05:30
Chris O
53a51b3529
Rewrite of base32.py algorithm (#9068)
* rewrite of base32.py

* changed maps to list comprehension

* Apply suggestions from code review

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

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-24 02:09:32 -04:00
omahs
b203150ac4
Fix typos (#9076)
* fix typo

* fix typo

* fix typos

* fix typo
2023-09-23 10:53:09 +02:00
Rohan Anand
dc50add8a7
Update xgboost_regressor.py (#9078)
* Update xgboost_regressor.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-09-23 10:51:36 +02:00
Tianyi Zheng
fbad85d3ec
Delete empty junk file (#9062)
* updating DIRECTORY.md

* updating DIRECTORY.md

* Delete empty junk file

* updating DIRECTORY.md

* Fix ruff errors

* Fix more ruff errors

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-09-17 00:12:31 +02:00
pre-commit-ci[bot]
1488cdea70
[pre-commit.ci] pre-commit autoupdate (#9056)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.287 → v0.0.288](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.287...v0.0.288)
- [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1)

* updating DIRECTORY.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-09-12 01:56:50 +02:00