Commit Graph

3401 Commits

Author SHA1 Message Date
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
Kamil
4246da387f
jacobi_iteration_method.py the use of vector operations, which reduces the calculation time by dozens of times (#8938)
* Replaced loops in jacobi_iteration_method function with vector operations. That gives a reduction in the time for calculating the algorithm.

* Replaced loops in jacobi_iteration_method function with vector operations. That gives a reduction in the time for calculating the algorithm.

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

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

* Delete main.py

* Update jacobi_iteration_method.py

Changed a line that was too long.

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

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

* Update jacobi_iteration_method.py

Changed the type of the returned list as required.

* Update jacobi_iteration_method.py

Replaced init_val with new_val.

* Update jacobi_iteration_method.py

Fixed bug: init_val: list[int]  to  list[float].
Since the numbers are fractional: init_val = [0.5, -0.5, -0.5].

* Update jacobi_iteration_method.py

Changed comments, made variable names more understandable.

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

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

* Update jacobi_iteration_method.py

left the old algorithm commented out, as it clearly shows what is being done.

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

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

* Update jacobi_iteration_method.py

Edits upon request.

* [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-11 13:05:32 +02:00
Kamil
97e2de0763
Euler 070 partial replacement of numpy loops. (#9055)
* Euler 070 partial replacement of numpy loops.

* Update project_euler/problem_070/sol1.py

* project_euler.yml: Upgrade actions/checkout@v4 and add numpy

* Update project_euler.yml

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-09-11 12:11:22 +02:00
Saransh Chopra
5a5ca06944
Update actions/checkout with fetch-depth: 0 (#9046)
* Update `actions/checkout` with `fetch-depth: 0`

* Update directory_writer.yml

* Create junk.py

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

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

* Update directory_writer.yml

* Update directory_writer.yml

---------

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-09-09 19:58:43 +02:00
Saksham Saha
c9b4b8002f
Added an add at position subroutiune to linked list (#9020)
* added addAtPosition to simple linked list

* added addAtPosition to simple linked list

* modified the add function to take an optional position command

* fixed type safety errors:

* fixed type safety errors:

* fixed type safety errors:

* fixed type safety errors:

* fixed size error

* fixed size error

* added doctest and updates the else after checking if posiiton argument less than 0 or not

* added doctest and updates the else after checking if posiiton argument less than 0 or not

* fixed the contributing.md mistake

* added doctest for out of bounds position value, both negative and positive
2023-09-08 08:20:28 -04:00
Rohan Saraogi
0cae02451a
Added nth_sgonal_num.py (#8753)
* Added nth_sgonal_num.py

* Update and rename nth_sgonal_num.py to polygonal_numbers.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-07 03:52:36 -04:00
Adarsh Acharya
153c35eac0
Added Scaled Exponential Linear Unit Activation Function (#9027)
* Added Scaled Exponential Linear Unit Activation Function

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

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

* Update scaled_exponential_linear_unit.py

* Update scaled_exponential_linear_unit.py

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

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

* Update scaled_exponential_linear_unit.py

* Update scaled_exponential_linear_unit.py

* Update scaled_exponential_linear_unit.py

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

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

* Update scaled_exponential_linear_unit.py

* Update scaled_exponential_linear_unit.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-06 15:16:51 -04:00
David Ekong
9e4f9962a0
Created harshad_numbers.py (#9023)
* Created harshad_numbers.py

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

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

* Update harshad_numbers.py

Fixed a few errors

* Update harshad_numbers.py

Added function type hints

* Update harshad_numbers.py

Fixed depreciated Tuple and List usage

* Update harshad_numbers.py

Fixed incompatible types in assignments

* Update harshad_numbers.py

Fixed incompatible type assignments

* Update maths/harshad_numbers.py

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

* Update maths/harshad_numbers.py

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

* Raised Value Error for negative inputs

* Update maths/harshad_numbers.py

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

* Update maths/harshad_numbers.py

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

* Update maths/harshad_numbers.py

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

* Update harshad_numbers.py

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

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

* Update harshad_numbers.py

* Update harshad_numbers.py

* Update harshad_numbers.py

* Update harshad_numbers.py

Added doc test to int_to_base, fixed nested loop, other minor changes

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-06 10:00:09 -04:00
Caeden Perelli-Harris
72f6000365
Fix get amazon product data erroring due to whitespace in headers (#9009)
* updating DIRECTORY.md

* fix(get-amazon-product-data): Remove whitespace in headers

* refactor(get-amazon-product-data): Don't print to_csv

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-09-05 00:49:00 -04:00
Rafael Zimmer
79b043d35c
Texture analysis using Haralick Descriptors for Computer Vision tasks (#8004)
* Create haralick_descriptors

* Working on creating Unit Testing for Haralick Descriptors module

* Type hinting for Haralick descriptors

* Fixed docstrings, unit testing and formatting choices

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

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

* Fixed line size formatting

* Added final doctests

* Changed main callable

* Updated requirements.txt

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

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

* Update computer_vision/haralick_descriptors.py

No! What if the Kernel is empty?
Example:

>>> kernel = np.zeros((1))
>>> kernel or np.ones((3, 3))
array([[1., 1., 1.],
          [1., 1., 1.],
          [1., 1., 1.]])

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

* Undone wrong commit

* Update haralick_descriptors.py

* Apply suggestions from code review

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

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

* Fix ruff errors in haralick_descriptors.py

* Add type hint to haralick_descriptors.py to fix ruff error

* Update haralick_descriptors.py

* Update haralick_descriptors.py

* Update haralick_descriptors.py

* Update haralick_descriptors.py

* Try to fix mypy errors in haralick_descriptors.py

* Update haralick_descriptors.py

* Fix type hint in haralick_descriptors.py

---------

Co-authored-by: Rafael Zimmer <rzimmerdev@monmo.localdomain>
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: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-05 00:04:36 -04:00
pre-commit-ci[bot]
ac73be2178
[pre-commit.ci] pre-commit autoupdate (#9042) 2023-09-05 08:27:05 +05:30
Kotmin
5a4ea233cd
Style sigmoid function in harmony with pep guideness (#6677)
* Style sigmoid function in harmony with pep guideness

* [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-09-04 13:38:26 -04:00
pre-commit-ci[bot]
421ace81ed
[pre-commit.ci] pre-commit autoupdate (#9013)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.285 → v0.0.286](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.285...v0.0.286)
- [github.com/tox-dev/pyproject-fmt: 0.13.1 → 1.1.0](https://github.com/tox-dev/pyproject-fmt/compare/0.13.1...1.1.0)

* updating DIRECTORY.md

* Fis ruff rules PIE808,PLR1714

---------

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>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-08-29 15:18:10 +02:00
Arijit De
0a9438071e
Updated postfix_evaluation.py to support Unary operators (#8787)
* Updated postfix_evaluation.py to support Unary operators and floating point numbers Fixes #8754 and #8724

Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py

Signed-off-by: Arijit De <arijitde2050@gmail.com>

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

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

* Updated postfix_evaluation.py to support Unary operators and floating point numbers. Fixes #8754 and formatted code to pass ruff and black test.

Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes #8724 and made sure it passes doctest

Signed-off-by: Arijit De <arijitde2050@gmail.com>

* Fixed return type hinting required by pre commit for evaluate function

Signed-off-by: Arijit De <arijitde2050@gmail.com>

* Changed line 186 to return only top of stack instead of calling the get_number function as it was converting float values to int, resulting in data loss. Fixes #8754 and #8724

Signed-off-by: Arijit De <arijitde2050@gmail.com>

* Made the requested changes

Also changed the code to make the evaluate function first convert all the numbers and then process the valid expression.

* Fixes #8754, #8724 Updated postfix_evaluation.py

postfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes #8724. Added a doctest example with unary operator.

* Fixes #8754, #8724 Updated postfix_evaluation.py

postfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes #8724. Added a doctest example with unary operator.

* Fixes #8754, #8724 Updated the parse_token function of postfix_evaluation.py

ostfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes #8724. Added a doctest example with unary operator and invalid expression.

* Fixes #8754, #8724 Updated postfix_evaluation.py

postfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes #8724. Added a doctest example with unary operator and invalid expression.

* Update postfix_evaluation.py

* Update postfix_evaluation.py

* Update postfix_evaluation.py

* Update postfix_evaluation.py

* Update postfix_evaluation.py

---------

Signed-off-by: Arijit De <arijitde2050@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-08-23 14:36:59 +02:00
Caeden Perelli-Harris
fceacf977f
Fix type errors in permutations (#9007)
* updating DIRECTORY.md

* types(permuations): Rename permute2

* Apply suggestions from code review

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

* fix(permutations): Call permute_recursive

* fix(permutations): Correct permutations order

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-22 02:33:47 -07:00
pre-commit-ci[bot]
c7aeaa3fd8
[pre-commit.ci] pre-commit autoupdate (#9006)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.284 → v0.0.285](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.284...v0.0.285)
- [github.com/abravalheri/validate-pyproject: v0.13 → v0.14](https://github.com/abravalheri/validate-pyproject/compare/v0.13...v0.14)
- [github.com/pre-commit/mirrors-mypy: v1.5.0 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.0...v1.5.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-08-22 07:42:14 +02:00
Caeden Perelli-Harris
04fd5c1b5e
Create langtons ant algorithm (#8967)
* updating DIRECTORY.md

* feat(cellular_automata): Langonts ant algorithm

* updating DIRECTORY.md

* Update cellular_automata/langtons_ant.py

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

* Apply suggestions from code review

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

* fix(langtons-ant): Set funcanimation interval to 1

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-21 16:20:51 -07:00
AmirSoroush
b3dc6ef035
fixes #9002; improve insertion_sort algorithm (#9005)
* fixes #9002; improve insertion_sort algorithm

* add type hints to sorts/insertion_sort.py
2023-08-21 16:17:02 -07:00
Caeden Perelli-Harris
1210559deb
Consolidate decimal to binary iterative and recursive (#8999)
* updating DIRECTORY.md

* refactor(decimal-to-binary): Consolidate implementations

* updating DIRECTORY.md

* refactor(decimal-to-binary): Rename main and helper recursive

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-21 06:25:20 -07:00
Dom
1984d97171
Refactorings (#8987)
* use np.dot

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

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

* further improvements using array slicing

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>
2023-08-20 16:43:09 -07:00
Guduly
672e7bde2e
Update arc_length.py (#8964)
* Update arc_length.py

Wrote the output of testcase

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

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

* Update arc_length.py

Added the requested changes

* Update arc_length.py

followed the change request

* Update arc_length.py

followed suggestions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-20 16:39:29 -07:00
Bama Charan Chhandogi
062957ef27
Octal to Binary Convert (#8949)
* Octal to Binary Convert

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

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

* mention return type

* code scratch

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

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

* mentioned return type

* remove comment

* added documention and some test cases

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

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

* add another test case

* fixes documention

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

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

* Documention and test cases added

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

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

* documention problem solved

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

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

* error in exit 1

* [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: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
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-08-20 05:40:23 -07:00
Tianyi Zheng
5ecb6baef8
Move and reimplement convert_number_to_words.py (#8998)
* Move and reimplement convert_number_to_words.py

- Move convert_number_to_words.py from web_programming/ to conversions/
- Reimplement the algorithm from scratch because the logic was very
  opaque and too heavily nested
- Add support for the Western numbering system (both short and long)
  because the original implementation only supported the Indian
  numbering system
- Add extensive doctests and error handling

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-20 08:36:00 -04:00