Commit Graph

196 Commits

Author SHA1 Message Date
DevanshiPatel18
dd757dce38
feat: Add greedy_coin_change.py algorithm (#3805)
* Hacktoberfest: Add greedy_coin_change.py file 

added the file in greedy_methods folder to implement the same method

Altered the code according to the changes that were requested.

* Added doctests.

doctests added to the function find_minimum_change.

* Added Greedy change file in Maths folder.

* updating DIRECTORY.md

* Deleted Greedy Method Folder

* updating DIRECTORY.md

* Update greedy_coin_change.py

* fix: black formatting issues

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2021-03-20 11:48:38 +05:30
algobytewise
2dc2c99f2b
refactor: Rename explicit_euler.py to euler_method.py (#4275)
* reupload

* Rename explicit_euler.py to euler_method.py

* Delete file
2021-03-20 11:41:10 +05:30
Christian Clauss
987567360e
Update our pre-commit dependencies (#4273)
* .pre-commit-config.yaml: mypy directories that pass

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-20 10:42:17 +05:30
Ayush Bisht
ced83bed2c
Add arithmetic_mean.py (#4243)
* arithmetic_mean

* arithmetic_mean

* checks

* checked

* Revert "checked"

This reverts commit 3913a39ae2.

* checks-3

* update-1
2021-03-12 08:25:54 +01:00
Ayush Bisht
0435128cc0
Add geometric_mean.py (#4244)
* geometric_mean3

* update-GM.PY

* update-AM.PY

* Revert "update-AM.PY"

This reverts commit 11792ec974.
2021-03-01 22:30:16 +01:00
CarsonHam
61f3119467
Change occurrences of str.format to f-strings (#4118)
* f-string update rsa_cipher.py

* f-string update rsa_key_generator.py

* f-string update burrows_wheeler.py

* f-string update non_recursive_segment_tree.py

* f-string update red_black_tree.py

* f-string update deque_doubly.py

* f-string update climbing_stairs.py

* f-string update iterating_through_submasks.py

* f-string update knn_sklearn.py

* f-string update 3n_plus_1.py

* f-string update quadratic_equations_complex_numbers.py

* f-string update nth_fibonacci_using_matrix_exponentiation.py

* f-string update sherman_morrison.py

* f-string update levenshtein_distance.py

* fix lines that were too long
2021-02-23 11:23:49 +05:30
SiddhantJain15
dd4b265680
Add function to calculate area of triangle using Heron's formula (#4065)
* Update area.py

Modified area of triangle function. Added a new algorithm to calculate area when 3 sides are known

* Add files via upload

* Update area.py

* Update area.py

* Update area.py

* Update area.py

* Remove unnecessary whitespace

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-12-28 13:36:57 +05:30
Du Yuanchao
bfb0c3533d
Fixed LGTM and typehint (#3970)
* fixed LGTM
fixed typehint

* updating DIRECTORY.md

* Update lucas_series.py

* Update lucas_series.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-11-28 22:42:30 +08:00
Andrew
10427f8395
Create euclidean_distance.py (#3350)
* Create distance_formula.py

* Remove whitespace

* Update distance_formula.py

* Update distance_formula.py

* Update distance_formula.py

* Generalize

* Grammar mistake

* Rename distance_formula.py to euclidean_distance.py

* Update euclidean_distance.py

* v1 - > v2

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

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

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-27 15:48:20 +01:00
Joyce
03e7f37329
[mypy] math/sieve_of_eratosthenes: Add type hints (#2627)
* add type hints to math/sieve
* add doctest
* math/sieve: remove manual doctest
* add check for negative
* Update maths/sieve_of_eratosthenes.py
* Update sieve_of_eratosthenes.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-23 11:07:42 +05:30
김수연
8a134e1f45
update area.py (#3862)
add method "area_ellipse"
- Calculate the area of a ellipse

Co-authored-by: 201502029 <tnehd158@naver.com>
2020-11-18 18:35:51 +08:00
sukyung99
78a0f61b19
Add Maths / Sigmoid Function (#3880)
* Add Maths / Sigmoid Function

* Update Sigmoid Function

* Add doctest and type hints

* Fix Trim Trailing Whitespace

* Fix Error

* Modified Black

* Update sigmoid.py

Co-authored-by: sukyung99 <tnrudsla413@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-15 09:14:40 +05:30
Jake Gerber
a538989939
Added decimal_isolate.py (#3700)
* Add files via upload

* Delete decimal_isolate.py

* Added decimal_isolate file.

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Delete decimal_isolate.py

* Add files via upload

* Update maths/decimal_isolate.py

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

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-30 23:10:44 +01:00
Joyce
a6831c898a
math/greatest_common_divisor: add support for negative numbers (#2628)
* add type hints to math/gcd

* add doctest

* math/gcd - run black formatter

* math/gcd: remove manual doctest

* add correction to gcd of negative numbers

* add more doctest in iterative gcd
2020-10-29 12:47:26 +05:30
Rolv Apneseth
8f81c460fe
Made improvements to combinations.py (#3681)
* Made improvements to combinations.py

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Function now raises an error when given invalid input

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-10-26 14:48:06 +08:00
Kushagra Bansal
b93a9d8e8f
Update lucas_series.py to include another method (#3620)
* Update lucas_series.py

Added another method to calculate lucas_numbers

* Fix pre-commit error

* Update lucas_series.py

* Update lucas_series.py

* Update lucas_series.py

* Update lucas_series.py
2020-10-26 09:37:11 +05:30
Du Yuanchao
81b82bea47
Update ceil and floor function (#3710)
* Update ceil and floor function

* add end line

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-26 00:02:24 +08:00
Rolv Apneseth
04fae4db9b
Improved and shortened prime_check.py (#3454)
* Made small improvements and shortened prime_check.py

* improved descriptions on tests in prime_check.py

* Ran black and isort
2020-10-24 00:17:29 +08:00
Christian Clauss
9b95e4f662
Pyupgrade to python3.8 (#3616)
* Upgrade to Python 3.8 syntax

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-21 12:46:14 +02:00
Joyce
e41d04112f
Fixes: #2630 Add doctests and support for negative numbers (#2626)
* add type hints to math/extended euclid

* math/extended euclid - add doctest

* math/extended euclid: remove manual doctest

* change algorithm for negative numbers

* improve naming of variables

* Update extended_euclidean_algorithm.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-07 15:23:14 +05:30
Du Yuanchao
437c725e64
Fixed allocation_number (#2768)
* fixed allocation_number

* fixed pre-commit

* fixed line too long

* fixed bug
2020-10-05 09:17:46 +05:30
Sabari Ganesh
fb9b9ecccf
Update area.py (#2524)
* Update area.py

Added Area for Rhombhus

* Update area.py

Added rhombhus area. And fixed some gaps error.

* Update area.py

Added Rhombhus area.

* Update area.py

Fixed suggested changes
2020-10-04 22:20:47 +08:00
Dhruv
acaeb22bbd
Add GitHub action for pre-commit (#2515)
* Add GitHub action file for pre-commit

* Fix errors exposed by pre-commit hook:

- Remove executable bit from files without shebang. I checked those
  file and it was not needed.
- Fix with black

* Apply suggestions from code review

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-30 15:23:34 +02:00
Dhruv
0a42ae9095
Fix all errors mentioned in pre-commit run (#2512)
* Fix all errors mentioned in pre-commit run:

- Fix end of file
- Remove trailing whitespace
- Fix files with black
- Fix imports with isort

* Fix errors
2020-09-30 10:38:00 +02:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Lewis Tian
121dddc7f2
Update maths/area.py (#2501)
the parameters of geometric shapes should be non-negative values
2020-09-28 22:40:47 +08:00
Christian Clauss
9200a2e543
from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Hasenn
20e98fcded
Fix some warnings from LGTM (#2420)
* fix assignment of a variable to itself

* Fix unnecessary 'else' clause in loop

* formatting and redundant reasignment fix

* mark unreachable code with a TODO comment

* fix variable defined multiple times

* fix static method without static decorator

* revert unintended autoformatting

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

* revert autoformatting issue

* applied black autoformatting

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 10:11:27 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
Björn Olsson Jarl
8c191f1fc9
Added type hints for maths/fibonacci_sequence_recursion. (#2372) 2020-08-30 10:51:45 +02:00
Björn Olsson Jarl
ab5a046581
Added type hints and doctest for maths/prime_check. (#2367)
* Added type hints and doctest for maths/prime_check.

* Removed doctests.
2020-08-29 17:11:02 +02:00
Kushagra Bansal
f2f0425357
Created ugly_numbers.py in Python/maths (#2366)
* Add files via upload

* Update ugly_numbers.py

* Update ugly_numbers.py

* Update ugly_numbers.py
2020-08-29 16:57:34 +02:00
Iheb Haboubi
2c0127d71a
Perfect square using binary search (#2351)
* Add perfect_square_binary_search

* Update tests

* Add tests
2020-08-25 21:26:11 +02:00
Du Yuanchao
0591968947
Optimization and fix bug (#2342)
* * optimization aliquot_sum
* fix bug in average_median

* fixup! Format Python code with psf/black push

* Update maths/average_median.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-21 14:39:03 +08:00
Du Yuanchao
34294b5641
Update sum_of_digits.py (#2319)
* * support negative number
* add different version

* fixup! Format Python code with psf/black push

* sum(int(c) for c in str(abs(n)))

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-16 20:31:06 +02:00
Du Yuanchao
d687030d9e
fix number_of_digits bug (#2301)
* fix bug

* test larger negative

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-12 18:32:35 +02:00
Filip Hlasek
871f8f4e00
More efficient least common multiple. (#2281)
* More efficient least common multiple.

* lowest -> least

* integer division

* Update least_common_multiple.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-05 12:39:15 +02:00
Christian Clauss
4535283554
Re-blacken (#2246)
* Avoid double spaces

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-01 09:23:23 +05:30
aryan26roy
373f193c6d
Correcting the Gaussian Formula (#2249)
* Correcting the Gaussian Formula

I have added the parenthesis around the 2*sigma^2 term.

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 21:32:36 +02:00
Utsav Akash Naskar
c7a5f1673e
Python Program to Check Krishnamurthy Number (#2248)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

* Added Python Program to Check Krishnamurthy Number or not

* Added Python Program to Check Krishnamurthy Number

* Added Python Program to Check Krishnamurthy Number or not

* Build Error Fix - 1

* Build Error Fix - 2

* Fix Brackets positions

* Fix Character Exceeding Error

* Made Review Changes

* Build Error Fix - 3

* Build Error Fix - 4

* Update krishnamurthy_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 10:54:05 +02:00
Utsav Akash Naskar
9ea144f3bd
Added Python Program to Check Perfect Number (#2244)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-28 09:59:44 +02:00
lance-pyles
093a56e3c2
Remove function overhead in area (#2233)
* remove function overhead
add type hints

* remove unused import
2020-07-27 21:29:31 +08:00
Utsav Akash Naskar
dfb4ce4074
Added Finding Exponent Program (#2238)
* Finding Exponent Program

* Build Error Fix - 1

* Build Error Fix - 2

* Error Fix - 1 datatype

* self-documenting naming convension added

* Update and rename exponent_recursion.py to power_using_recursion.py

* Fix typo

* Fix typo

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-27 11:33:13 +02:00
Vasu Gamdha
e296f7b3ff
Updated maths/number_of_digits.py (#2221)
* Updated number_of_digits.py

Added two more methods!

* Update number_of_digits.py

* Update number_of_digits.py

* Added benchmarks!

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py
2020-07-26 12:42:18 +02:00
lance-pyles
b3950035a6
update variable names for consistency using standard formula terms; (#2223)
* update variable names for consistency using standard formula terms;

fix flake8 syntax errors;

fix doctests;

* tweak to variable name
2020-07-23 00:49:34 +02:00
XxSamixX123
749ffd8c6f
Added a binomial distribution formula calculator algorithm (#2197)
* Add files via upload

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

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

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

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

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-13 22:18:37 +02:00
Advik Kulkarni
6c2c08c076
sum_of_geometric_progression (#2168)
* Add files via upload

* Rename sum_of_Geometric_Progression.py to sum_of_geometric_progression.py

* Update sum_of_geometric_progression.py

* Update maths/sum_of_geometric_progression.py

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

* Update maths/sum_of_geometric_progression.py

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

* Update maths/sum_of_geometric_progression.py

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

* Update sum_of_geometric_progression.py

* Update sum_of_geometric_progression.py

* Type hints and test for zeros and negative numbers

* Update sum_of_geometric_progression.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-10 14:56:43 +02:00
lance-pyles
48df91d48b
Add surface area class (#2183)
* add surface area class

* add new line to end of file

* move surface area class into area class

* add missing import

* added pi import

* fix typo

* added blank line

* fixed more import issues

* comment fix

* comment fixes
2020-07-07 00:21:59 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
Christian Clauss
f97af65579
Blacken our code (#2125)
* Blacken

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-17 06:59:38 +08:00