Commit Graph

2823 Commits

Author SHA1 Message Date
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
fpringle
75759fae22
Add solution for Project Euler problem 085 (#4024)
* Added solution for Project Euler problem 085.

* updating DIRECTORY.md

* Minor tweaks to Project Euler problem 85

* Variable comments for project euler problem 85

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-10 18:48:17 +05:30
Umair Kamran
bd4b83fcc7
Chore: Added type hints to searches/binary_search.py (#2682)
* Chore: Added type hints to searches/binary_search.py

* Use -1 as the sentinal value

* Wrap long lines

* Update binary_search.py

* Update binary_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-12-09 15:01:58 +01:00
fpringle
b1801398ec
Add Project Euler Problem 180 (#4017)
* Added solution for Project Euler problem 180

* Fixed minor details in Project Euler problem 180

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-09 16:44:51 +05:30
Alex Joslin
e7ab06f5de
Implemented minimum steps to one using tabulation. (#3911)
* Implemented minimum steps to one using tabulation.

* Update minimum_steps_to_one.py

Made the parameter "n" more descriptive.  Changed it to number

* `n` to `number`

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-12-09 17:22:07 +08:00
Lewis Tian
c39be1d8b8
update graphs/breadth_first_search.py (#3908)
* update graphs/breadth_first_search.py

- update naming style to snake_case
- add type hints

* add doctests
2020-12-09 17:21:46 +08:00
Jogendra Singh
c359768e25
Update bitonic_sort with type hints, doctest, snake_case names (#4016)
* Updated input
* Fix pre-commit error
* Add type hints, doctests, black, snake_case

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-12-09 11:38:49 +05:30
Maliha
860d4f547b
Create merge_two_lists.py that implements merging of two sorted linked lists (#3874)
* Create merge_two_lists.py that implements merging of two sorted linked lists

* Update merge_two_lists.py

Fixed formatting errors

* Fixed trailing whitespace

* Change name of function to def __str__()

* updating DIRECTORY.md

* Imported classes from singly_linked_list.py

* Update merge_two_lists.py

* Update merge_two_lists.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-12-03 16:02:48 +01:00
Dhruv Manilawala
f8b2c43fda
Fix pre-commit error on master (#3992)
* Update pigeon_sort.py

* updating DIRECTORY.md

* Add type hints and return annotation

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-30 21:03:29 +05:30
wuyudi
07a4ce9fb8
Update pigeon_sort.py (#2359)
* Update pigeon_sort.py

* Update pigeon_sort.py

* Update pigeon_sort.py
2020-11-30 20:29:23 +05:30
Erdum
daceb87a96
Electric power (#3976)
* Electric power

* updated as suggested by cclauss

* updated as suggested by cclauss

* decimal value error

* All done
2020-11-29 23:07:10 +01:00
John Law
06dad4f9d8
Fix mypy in #3149 (#3988)
* Fix mypy in #3149 
* Fix pre-commit
2020-11-29 23:16:26 +05:30
Dhruv Manilawala
ba6310b647
Validate only submitted Project Euler solution (#3977)
* Update validate solution script to fetch only submitted solution
* Update workflow file with the updated PE script
* Fix: do not fetch `validate_solutions.py` script
* Update script to use the requests package for API calls
* Fix: install requests module
* Pytest ignore scripts/ directory
2020-11-29 23:11:09 +05:30
John Law
25164bb638
Fix mypy in #2684 (#3987)
* Fix mypy in #2684

* fix pre-commit
2020-11-29 23:00:31 +05:30
Jenia Dysin
0febbd397e
Add typehints to blockchain (#3149)
* updating DIRECTORY.md

* updating DIRECTORY.md

* Added type hints to blockchain algorithms

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-30 00:20:54 +08:00
Jenia Dysin
e07766230d
Add static typing to backtracking algorithms (#2684)
* Added static typing to backtracking algorithms

* Ran psf/black to fix some minor issues.

* updating DIRECTORY.md

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-11-30 00:19:50 +08:00
jenra
5de90aafc7
Hacktoberfest 2020: Conway's Game of Life (#3070)
* Created conways_game_of_life.py

* Added new_generation(list[int[int]]) -> list[list[int]]

* Added glider example

* Added comments and shortened glider example

* Fixed index out of bounds error

* Added test

* Added blinker example

* Added ability to generate images

* Moved image generating code into a separate function

* Added comments

* Comment

* Reformatted file

* Formatting

* Removed glider test

* Update cellular_automata/conways_game_of_life.py

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

* Update conways_game_of_life.py

* Update conways_game_of_life.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-11-29 17:09:33 +01:00
Sullivan
52a6213ddc
Instagram Video and IGTV downloader (#3981)
* Instagram Video and IGTV downloader 

Download Video and IGTV from Instagram

* Update

* Update

* Some Change

* Update

* Update instagram_video.py

* Update instagram_video.py

* Update instagram_video.py

* Update instagram_video.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-29 13:14:18 +01:00
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
xcodz-dot
8cafadd759
Update CONTRIBUTING.md with pre-commit plugin instructions (#3979)
* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

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

* Update CONTRIBUTING.md

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

* Update CONTRIBUTING.md

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-28 19:09:27 +05:30
arif599
9c6080a6fc
data_structures/linked_list: Add __str__() function (#3961)
* Adding __str__() function

* Removing white space

* Update data_structures/linked_list/__init__.py

Co-authored-by: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com>

* Adding type hints

* Update __init__.py

* Update __init__.py

* Adding the changes requested

* Updating to fix pre-commit

* Updating __init__.py

* Updating __init__.py

Co-authored-by: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com>
2020-11-28 11:20:18 +05:30
fpringle
1e1708b8a1
Added solution for Project Euler problem 77 (#3132)
* Added solution for Project Euler problem 77.

* Update docstrings, doctest, type annotations and 0-padding in directory name. Reference: #3256

* Implemented lru_cache, better type hints, more doctests for problem 77

* updating DIRECTORY.md

* updating DIRECTORY.md

* Added solution for Project Euler problem 77. Fixes: 2695

* Update docstrings, doctest, type annotations and 0-padding in directory name. Reference: #3256

* Implemented lru_cache, better type hints, more doctests for problem 77

* better variable names

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-27 21:38:14 +05:30
Anubhav Solanki
9333d2f017
Create weight_conversion.py (#3964)
* Create weight_conversion.py
* Update weight_conversion.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-27 21:33:17 +05:30
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
Dhruv Manilawala
c5fb0a9504
Cleaned up knapsack and images directory (#3972) 2020-11-27 10:57:12 +01:00
Vivek
ac6a160f1b
added binary_count_trailing_zeros.py (#2557)
* added binary_count_trailing_zeros.py

* updated binary_count_trailing_zeros.py file

* changed file name to count_trailing_zeros.py

* updated count_trailing_zeros.py

* resolved flake8 error

* renamed to binary_count_trailing_zeros.py

* added required changes

* resolved pre-commit error

* added count_setbits.py

* resolved errors

* changed name to binary_count_setbits.py

* updated file

* reformated file
2020-11-26 09:27:00 +08:00
Hafidh
ce3ce3f8a8
Replace base64_cipher.py with an easy to understand version (#3925)
* rename base64_cipher.py to base64_encoding.py

* edit base64_encoding.py

* import necessary modules inside doctests

* make it behave like the official implementation

* replace format with f-string where possible

* replace format with f-string

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

* fix: syntax error due to closing parenthese

* reformat code

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-25 13:38:02 +01:00
Erdum
4191b95942
Ohm's Law algorithm added (#3934)
* New algorithm added

* Errors resolvedc

* New Algorithm

* New algorithm added

* Added new algorithm

* work

* New algorithm added

* Hope this is final

* Update electronics/ohms_law.py

Co-authored-by: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com>

* update decimal value & negative value test

* update as cclauss suggest

* Update electronics/ohms_law.py

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

* updated as suggested by cclauss

* update as suggested by cclauss

* Update as suggested by cclauss

* Update ohms_law.py

Co-authored-by: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-25 12:01:49 +01:00
YeonJeongLee00
2b50aaf2d3
Create intro_sort.py (#3877)
* Create intro_sort.py

* modified intro_sort.py

* add doctest

* modified code

black intro_sort.py

* add more test

* Update intro_sort.py

added doctest, modified code

* black intro_sort.py

* add type hint

* modified code
2020-11-25 09:54:31 +01:00
Dhruv Manilawala
5eb5483d65
Update stalebot to take 5 actions per hour (#3922)
* Update stalebot to take 5 actions per hour

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-25 13:23:49 +05:30
lawric1
098f02bc04
Fixes: #3944 Authentication error; use tokens instead (#3949)
* fixes #3944 authentication error
* Fixes: #3944 authentication error
* Fixed docstring failure in pre-commit, Fixed request.get params to GitHub REST API standards
* run black formatter
* Add USER_TOKEN constant and checks if empty, removes deprecated docstring
* Add descriptive dict type hint, change headers format to f-string
* Add Accept header
* Fix pre-commit error
* Fix pre-commit error
* Add test for fetch_github_info
* Remove test function from main file
* Create test_fetch_github_info.py
* Update test_fetch_github_info.py
* Update test_fetch_github_info.py
* No need to cover __name__ == __main__ block

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-25 10:43:14 +05:30
Cho Yin Yong
287bf26bc8
Add a divide and conquer method in finding the maximum difference pair (#3692)
* A divide and conquer method in finding the maximum difference pair

* fix formatting issues

* fix formatting issues

* add doctest runner
2020-11-25 08:30:15 +08:00
Sullivan
e031ad3db6
Create instagram_pic (#3945)
* Create instagram_pic

* Update instagram_pic

* Update instagram_pic

* isort

* Update instagram_pic.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-24 17:18:00 +01:00
Christian Clauss
3fdbf9741d
Python 3.9 (#3926)
* Upgrade to Python 3.9

* pip install wheel for faster builds

* updating DIRECTORY.md

* requirements.txt: tensorflow; python_version < '3.9'

* keras requires tensorflow

* Rename lstm_prediction.py to lstm_prediction.py_tf

* Update requirements.txt

* updating DIRECTORY.md

* Update requirements.txt

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-24 12:41:10 +01:00
Tan Yong He
9bf7b183e7
Improve Base16 Codebase (#3534)
* Add doctest and remove input() usage

* Apply suggestions from code review

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-23 13:01:43 +05:30
Mikail Farid
49d0c41905
Renamed octal_to_decimal to octal_to_decimal.py (#3420)
* Renamed octal_to_decimal to octal_to_decimal.py
* Updated octal_to_decimal.py
* modified doctests
* updated octal_to_decimal.py
2020-11-23 11:41:28 +05:30