Commit Graph

2358 Commits

Author SHA1 Message Date
algobytewise
ffa53c02a7
Include mypy instructions in CONTRIBUTING.md (#4271)
* reupload

* Include mypy instructions

* delete file

* fixed trailing whitespaces

* options before file path

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-19 11:29:54 +01:00
algobytewise
8e488dd53d
mypy-fix for "covid_stats_via_xpath.py" (#4233) 2021-03-19 06:27:32 +01:00
Shantanu Joshi
4f6a929503
[mypy] Add/fix type annotations for electronics algorithms (#4247)
* Fix mypy errors for scheduling/first_come_first_served

* Fix mypy errors for scheduling/round_robin.py

* Fix mypy errors for scheduling/shortest_job_first.py

* Fix isort errors

* Fix mypy errors for electronics/ohms_law.py

* Fix mypy errors for electronics/electric_power.py

* Fix black errors
2021-03-18 08:39:53 +01:00
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
fpringle
ecf9b8164f
Added solution for Project Euler problem 109 (#4080)
* Added solution for Project Euler problem 109

* New subscriptable builtin types

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-06 18:59:52 +05:30
ulwlu
a796ccf1ce
Add graham scan algorithm (#4205)
* Add graham scan algorithm

* Fix argument name p with point

* Add tests in inner function

* updating DIRECTORY.md

* Fix graham scan for isort --profile=black

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-02 13:24:41 +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
algobytewise
4c76e3cba0
[mypy] Added/fixed type annotations for "rotate_matrix.py" & "test_matrix_operation.py" (#4221)
* [mypy] Added/fixed type annotations for "rotate_matrix.py"

* [mypy] Added/fixed type annotations for "test_matrix_operation.py"
2021-02-26 14:30:35 +01:00
杜远超
67b33a295b
Optimization shell sort (#4119)
* optimization

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-02-26 09:01:50 +08:00
algobytewise
71b1202d04 fixed-renaming 2021-02-23 21:07:36 +03:00
algobytewise
7bf1d622ef snake_case-fix 2021-02-23 21:07:36 +03:00
algobytewise
4c6b92f30f Add Mandelbrot algorithm 2021-02-23 21:07:36 +03:00
algobytewise
7df393f123
mypy-fix for bezier_curve.py (#4220) 2021-02-23 10:15:04 +01:00
Matthew
a4726ca248
[mypy]Correction of all errors in the sorts directory (#4224)
* [mypy] Add/fix type annotations for recursive_insertion_sort(#4085)

* [mypy] Add/fix type annotations for bucket_sort(#4085)

* [mypy] Reworked code for cocktail_shaker_sort so that missing return statement error is resolved(#4085)

* [mypy] Add/fix type annotations for patience_sort(#4085)

* [mypy] Add/fix type annotations for radix_sort(#4085)

Co-authored-by: goodm2 <4qjpngu8mem8cz>
2021-02-23 10:02:30 +01:00
Leyza
02d9bc66c1
Added binary shifts and twos complement functions to bit manipulation (#4068)
* Added binary shifts and twos complement functions to bit manipulation package

* Fixed problem representing 0 wrong

* More testing

* Fixed problems

* Fixed formatting

* More format fixes

* Format fixes

* Fixed docstrings and added url

* Minor change to url
2021-02-23 11:45:00 +05:30
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
Hao LI
f680806894
add type hints for avl_tree (#4214)
Co-authored-by: LiHao <leo_how@163.com>
2021-02-22 00:58:17 +01:00
algobytewise
2a6e4bbdb6
[mypy] Add/fix type annotations for "conways_game_of_life.py" & "one_dimensional.py" (#4216)
Related Issue: #4052
2021-02-22 00:54:29 +01:00
Matthew
81c46dfd55
[mypy] Add/fix type annotations for quick_sort(#4085) (#4215)
Co-authored-by: goodm2 <4qjpngu8mem8cz>
2021-02-20 23:10:23 +01:00
algobytewise
6bb9a027bb
Implementation of the algorithm for the Koch snowflake (#4207)
* Add files via upload

Implementation of the algorithm for the Koch snowflake

* added underscore to variable names

* added newline and comment

I fixed the sorting of the imports and I added a comment to the plot-function to explain what it does and why it doesn't use a doctest. Thank you to user mrmaxguns for suggesting these changes.

* fixed accidental newline in the middle of expression

* improved looping

* moved "koch_snowflake.py" from "other" to "graphics"

* Update koch_snowflake.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-02-20 14:09:39 +01:00
Liu Baolin--CN
bfb5700c67
Update LICENSE.md (#4210) 2021-02-19 19:15:19 +01:00
MarineJoker
78ddb46066
Quick sort with lomuto partition (#3875)
* add quick sort algorithm with Lomuto partition

* fix(lomuto_partition): fix snake_case
2021-02-17 15:28:50 +01:00
Ayush Bisht
d3ac521b63
add count_number_of_one_bits.py (#4195)
* count-bits

* update
2021-02-12 07:59:24 +05:30
Ocean Monjur
f66325a01b
odd_even_sort.py (#4199)
* odd_even_sort.py

* Update odd_even_sort.py

* Update odd_even_sort.py
2021-02-11 17:49:53 +01:00
Abdeldjaouad Nusayr Medakene
4903a65779
Create slowsort.py (#3865)
* Create slowsort.py

added slowsort algorithm implementation to sorts

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py

* Update slowsort.py
2021-02-09 17:13:48 +01:00
Hao LI
2595cf059d
[mypy] Add/fix type annotations for binary trees in data structures (#4085)
* fix mypy: data_structures:binary_tree

* mypy --strict for binary_trees in data_structures

* fix pre-commit

Co-authored-by: LiHao <leo_how@163.com>
2021-02-05 00:59:38 +08:00
Ayush Raj
97b6ca2b19
[mypy] Add/fix type annotations for boolean_algebra (#4172)
* [mypy] Add/fix type annotations for boolean_algebra

* [mypy] Add/fix type annotations for boolean_algebra

* [mypy] Add/fix annotations for boolean_algebra
2021-02-05 00:58:29 +08:00
ayushbisht2001
3f1e376bbc
add reverse_bits.py (#4120)
* add reverse_bits.py

* check

* Delete binary_xor_operator_new.py

* Fix All the errors

Co-authored-by: xcodz-dot <xcodz-dot@users.noreply.github.com>
2021-01-27 15:54:57 +05:30
Steve Kim
d594f4556c
[mypy] Add/fix type annotations for similarity search in machine learning (#4088)
* [mypy] Add/fix type annotations for similarity search in machine learning

* fix annotation

* fix annotation (Union)

* isort
2021-01-22 10:10:21 +05:30
Tapajyoti Bose
7d26ba7075
Added diffie-hellman algorithm (#4128)
* updating DIRECTORY.md

* feat: added diffie-hellman key exchange algorithm

* fix: enforce maxline length = 88

* fix: fixed import order

* fix: used flake to correct styling

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-01-21 08:30:47 +05:30
Gaurav Jindal
0728cf1128
Added code to merge two trees (#4121)
* Added code to merge two trees

* Added doctest and type hints

* Added pre-commit
2021-01-18 13:08:22 +05:30
Nwachukwu Chidiebere Godwin
03d34350f6
Graph list patch (#4113)
* new implementation for adjacency list graph

* add example code for undirected graph

* reduce length to 88 columns max to fix build errors7

* fix pre commit issues

* replace print_list method with __str__

* return object in add_edge method to enable fluent syntax

* improve class docstring and include doctests

* add end of file line

* fix pre-commit issues

* remove __str__ method

* trigger build

* Update graph_list.py

* Update graph_list.py

Co-authored-by: gnc <chidieberen1999@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-01-12 14:41:48 +01:00
Kanak
677d48d6c0
Rename coin_change.py to minimum_coin_change.py (#4108) 2021-01-11 16:55:15 +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
fpringle
80f5213df5
Add solution for Project Euler problem 107 (#4066)
* Added solution for Project Euler problem 107

* Doctests and better variable names

* Type hints

* Small edits

* Forward reference for typing hint

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-28 13:21:02 +05:30
shan7030
00e279ea44
[mypy] Add/fix type annotations for scheduling algorithms (#4074)
* Fix mypy errors for scheduling/first_come_first_served
* Fix mypy errors for scheduling/round_robin.py
* Fix mypy errors for scheduling/shortest_job_first.py
* Fix isort errors
2020-12-28 09:34:40 +05:30
Ramandeep Singh
64d8504170
Add 2-hidden layer neural network with back propagation using sigmoid activation function (#4037)
* added neural network with 2 hidden layers

* Revert "added neural network with 2 hidden layers"

This reverts commit fa4e2ac86e.

* added neural network with 2 hidden layers

* passing pre-commit requirements

* doctest completed

* added return hints

* added example

* example added

* completed doctest's

* changes made as per the review

* changes made

* changes after review

* changes

* spacing

* changed return type

* changed dtype
2020-12-26 21:43:20 +05:30
Mark Huang
207ac957ef
[mypy] Add type hints and docstrings to heap.py (#3013)
* Add type hints and docstrings to heap.py

- Add type hints
- Add docstrings
- Add explanatory comments 
- Improve code readability
- Change to use f-string

* Fix import sorting

* fixup! Format Python code with psf/black push

* Fix static type error

* Fix failing test

* Fix type hints

* Add return annotation

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-12-26 08:42:37 +05:30
Dhruv Manilawala
8f47d9f807
Fix type annotations for bit manipulation algorithms (#4056) 2020-12-24 18:16:44 +05:30
Dhruv Manilawala
f3ba9b6c50
[mypy] Add/fix type annotations for backtracking algorithms (#4055)
* Fix mypy errors for backtracking algorithms

* Fix CI failure
2020-12-24 18:16:21 +05:30
fpringle
0ccb213c11
Add solution for Project Euler problem 102 (#4051)
* Added solution for Project Euler problem 102

* Got rid of map functions

* Snake case variable names

* Type hints

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-23 23:18:19 +05:30
Dhruv Manilawala
ad5108d6a4
Fix mypy errors for arithmetic analysis algorithms (#4053) 2020-12-23 10:52:43 +01:00
fpringle
2ff2ccbeec
Add solution for Project Euler problem 101 (#4033)
* Added solution for Project Euler problem 101

* Got rid of map functions

* updating DIRECTORY.md

* Better function/variable names

* Better variable names

* Type hints

* Doctest for nested function

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-22 17:32:31 +05:30
Kavindu Santhusa
03889613bc
add integer to roman function (#4050)
* add integer to roman function

simply added fastest method i found.

* Rename roman_to_integer.py to roman_numerals.py

* Update roman_numerals.py

* Update roman_numerals.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-12-21 22:55:59 +01:00
sharmapulkit04
00f22a9970
Add solution for Project Euler problem 135 (#4035) 2020-12-19 11:46:15 +05:30
Du Yuanchao
53371b2381
Optimization for shell sort (#4038)
* fixed shell sort

* udpate code style

* Update sorts/shell_sort.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-12-18 10:39:51 +01:00
fpringle
ae8a5f8675
Add solution for Project Euler problem 59 (#4031)
* Added solution for Project Euler problem 59

* updating DIRECTORY.md

* Formatting, type hints, no more evil map functions

* Doctests

* Added doctests for Project Euler problem 59

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-13 16:39:52 +05:30
fpringle
a6f6eb2649
Add solution for Project Euler problem 86 (#4025)
* Added solution for Project Euler problem 86

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-12 10:49:35 +05:30
zakademic
533e36d32b
Add conjugate gradient method algorithm (#2486)
* Initial commit of the conjugate gradient method
* Update linear_algebra/src/conjugate_gradient.py
* Added documentation links, changed variable names to lower case and more descriptive naming, added check for symmetry in _is_matrix_spd
* Made changes to some variable naming to be more clear
* Update conjugate_gradient.py

Co-authored-by: Zeyad Zaky <zeyadzaky@Zeyads-MacBook-Pro.local>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-12-12 10:10:23 +05:30
Abdeldjaouad Nusayr Medakene
110a740d5d
Update ciphers/caesar_cipher.py with type hints (#3860)
* Update caesar_cipher.py

improved for conciseness and readability

* Add type hints

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-12-10 22:55:57 +05:30