Commit Graph

1956 Commits

Author SHA1 Message Date
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
poloso
c6dd975389
Add type hints and tests. (#2461)
* Add type hints, documentation and tests.

* Update searches/ternary_search.py

Sort collection and remove the assertion logic.

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

* Remove assert sorted logic.

* Add assertion list is ordered.

* updating DIRECTORY.md

* updating DIRECTORY.md

* Format with black.

* Change names of variables to descriptive names

* Remove print in doctests

* Fix variables to snake_case notation.

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-14 22:34:29 +05:30
Steve Kim
ae4d7d4d04
add similarity_search.py in machine_learning (#3864)
* add similarity_search.py in machine_learning
adding similarity_search algorithm in machine_learning

* fix pre-commit test, apply feedback

isort, codespell changed.
applied feedback(np -> np.ndarray)

* apply feedback

add type hints to euclidean method

* apply feedback

- changed euclidean's type hints
- changed few TypeError to ValueError
- changed range(len()) to enumerate()
- changed error's strings to f-string
- implemented without type()
- add euclidean's explanation

* apply feedback

- deleted try/catch in euclidean
- added error tests
- name change(value -> value_array)

* # doctest: +NORMALIZE_WHITESPACE

* Update machine_learning/similarity_search.py

* placate flake8

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-13 15:26:17 +01:00
boyuuuun
32def4b3c5
add crawl_google_scholar_citation.py (#3879)
* add crawl_google_scholar_citation.py

* pass flack8

* pass isort

* pass isort

* change comment in main

* modify main code

* delete file

* change how to build url

* add a key 'hl' in params dict

* Update crawl_google_scholar_citation.py

* Create crawl_google_results.py

* codespell: Mater

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-13 14:55:23 +01:00
Rupansh
9f6188cc40
Add Quantum Full Adder circuit for classical integers (#2954)
* requirements: add qiskit

major library required for quantum computing

* quantum: add quantum ripple adder implementation

right now we are essentially performing the same task as a classic ripple adder

Signed-off-by: rupansh-arch <rupanshsekar@hotmail.com>
2020-11-11 19:24:31 +08:00
Cho Yin Yong
eb5a951603
Peak of unimodal list DNC algorithm (#3691)
* Peak of unimodal list DNC algorithm

* fix black formatting issues

* add doctest testing

* make file black compliant
2020-11-11 19:17:54 +08:00
poloso
4851942ec0
Reduce complexity linear_discriminant_analysis. (#2452)
* Reduce complexity linear_discriminant_analysis.

* Fix whitespace

* Update machine_learning/linear_discriminant_analysis.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* fixup! Format Python code with psf/black push

* Fix format to surpass pre-commit tests

* updating DIRECTORY.md

* Update machine_learning/linear_discriminant_analysis.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* fixup! Format Python code with psf/black push

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-11 08:05:11 +05:30
Prakhar Gurunani
a6ad25c351
Add molecular_chemistry.py (#2944)
* Create molecular_chemistry.py

* round up outputs

* Remove floating point

* Add Wikipedia references

* fixup! Format Python code with psf/black push

* Add Conversions/Molecular Chemistry

* updating DIRECTORY.md

* Update molecular_chemistry.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-10 08:20:27 +01:00
Shivanirudh
eab6b70e0a
DPLL algorithm (#3866)
* DPLL algorithm

* Corrections complete

* Formatting

* Codespell hook

* Corrections part 2

* Corrections v2

* Corrections v3

* Update and rename dpll.py to davis–putnam–logemann–loveland.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-08 18:26:22 +01:00
Dhruv Manilawala
3d7704f0bf
Add config details for the stale action (#3870) 2020-11-08 21:31:14 +05:30
Lewis Tian
83a24cb06d
Update graphs/graph_list.py (#3813)
- update naming style to snake_case
- add type hints
2020-11-08 20:34:01 +05:30
Simon Landry
686d837d3e
Add project euler problem 50 (#3016)
* Add project euler problem 50

* Apply format changes

* Descriptive function/parameter name and type hints

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-08 08:26:10 +05:30
Frank Schmitt
c0d88d7f71
Fix handling of non ascii characters in swap case (fixes: #3847) (#3848)
* #3847 fix handling of non-ASCII characters in swap_case

* #3847 remove unused regex

* Fix formatting (with black) Fixes: #3847

* Add type hints for `swap_case` function

Co-authored-by: Frank Schmitt <frankschmitt@gmx.de>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-06 22:39:12 +05:30
Ravi Kandasamy Sundaram
c8db6a208b
Add solution for Project Euler problem 123 (#3072)
Name: Prime square remainders

Let pn be the nth prime: 2, 3, 5, 7, 11, ..., and
let r be the remainder when (pn−1)^n + (pn+1)^n is divided by pn^2.

For example, when n = 3, p3 = 5, and 43 + 63 = 280 ≡ 5 mod 25.
The least value of n for which the remainder first exceeds 10^9 is 7037.

Find the least value of n for which the remainder first exceeds 10^10.

Reference: https://projecteuler.net/problem=123

reference: #2695

Co-authored-by: Ravi Kandasamy Sundaram <rkandasamysundaram@luxoft.com>
2020-11-06 22:25:02 +05:30
Dhruv Manilawala
fdba34f704
Cache pre-commit workflow (#3863) 2020-11-05 12:06:59 +01:00
Shikhar Rai
29d0fbb0e0
HACKTOBERFEST - Added solution to Euler 64. (#3706)
* Added solution to Euler 64.

Added Python solution to Project Euler Problem 64.
Added a folder problem_064.
Added __init__.py file.
Added sol1.py file.

* Update sol1.py

Made formatting changes as mentioned by pre-commit

* Update sol1.py

Minor changes to variable naming and function calling as mentioned by @ruppysuppy

* Update sol1.py

Changes to function call as mentioned by @cclauss
2020-11-03 08:48:14 +05:30
Fernando Benjamín PÉREZ MAURERA
ff00bfa0ab
Added a solution for Project Euler Problem 203 "Squarefree Binomial Coefficients" (#3513)
* Added a solution for Project Euler Problem 203 (https://projecteuler.net/problem=203)

* Simplified loop that calculates the coefficients of the Pascal's Triangle. Changes based on review suggestion.

* Moved get_squared_primes_to_use function outside the get_squarefree function and fixed a failing doctest with the former.
2020-11-03 07:51:13 +05:30
Cho Yin Yong
eaa7ef45c5
kth order statistic divide and conquer algorithm (#3690)
* kth order statistics divide and conquer algorithm

* add explanation of algorithm.

* fix PEP8 line too long error

* update order to be compliant to isort

* add doctest

* make file black compliant
2020-11-03 09:31:33 +08:00
Peter Yao
61cb921d87
Project Euler 206 Solution (#3829)
* Readd Project Euler 206 solution for issue #2695, dupe of pull request #3042

* Add PE 206 to directory

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-02 23:24:20 +05:30
Du Yuanchao
786b32431c
Update infix to postfix (#3817)
* add test to infix_to_postfix_conversion

* fixed pre-commit error

* fixed build error

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-02 00:35:31 +08:00
GGn0
d8f573c0fb
Add solution to problem 74 (#3110)
* Add solution to problem 74

* Fix typo

* Edit unnecessary comment

* Rename folder, add default params in solution()

* Rename file to solve conflicts

* Fix doctests
2020-11-01 21:12:21 +08:00
Akash Kumar
d3ead53882
Added solution to Project Euler problem 301 (#3343)
* Added solution to Project Euler problem 301

* Added newline to end of file

* Fixed formatting and tests

* Changed lossCount to loss_count

* Fixed default parameter value for solution

* Removed helper function and modified print stmt

* Fixed code formatting

* Optimized solution from O(n^2) to O(1) constant time

* Update sol1.py
2020-11-01 16:27:48 +05:30
jbaenaxd
1f65007456
Shortened code (#3855) 2020-11-01 15:38:11 +08:00
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
ParamonPlay
c83ecacc31
No issues so far (#3835)
* Simplify GitHub Actions

* Update stale.yml

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-30 15:11:15 +01:00
Du Yuanchao
a03b3f763f
Balanced parentheses (#3768)
* Fixed balanced_parentheses.py

* fixed pre-commit

* eliminate is_paired

* remove unused line

* updating DIRECTORY.md

* Update data_structures/stacks/balanced_parentheses.py

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

* Add more test cases

* Update data_structures/stacks/balanced_parentheses.py

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

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-29 10:39:19 +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
PetitNigaud
99adac0eb1
Add first solution for Project Euler Problem 207 (#3522)
* add solution to Project Euler problem 206

* Add solution to Project Euler problem 205

* updating DIRECTORY.md

* updating DIRECTORY.md

* Revert "Add solution to Project Euler problem 205"

This reverts commit 64e3d36cab.

* Revert "add solution to Project Euler problem 206"

This reverts commit 53568cf4ef.

* add solution for project euler problem 207

* updating DIRECTORY.md

* add type hint for output of helper function

* Correct default parameter value in solution

* use descriptive variable names and remove problem solution from doctest Fixes: #2695

Co-authored-by: nico <esistegal-aber@gmx.de>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-29 12:34:42 +05:30
fpringle
9971f981a1
Added solution for Project Euler problem 87. (#3141)
* Added solution for Project Euler problem 87. Fixes: #2695

* Update docstring and 0-padding in directory name. Reference: #3256
2020-10-29 12:19:33 +05:30
Marcos Vinicius
a1e9656eca
Hacktoberfest: adding doctest to radix_sort.py file (#2779)
* adding doctest to radix_sort.py file

* fixup! Format Python code with psf/black push

* Update radix_sort.py

* Update radix_sort.py

* fixup! Format Python code with psf/black push

* Update radix_sort.py

* line

* fix tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-29 11:09:39 +08:00
sharmapulkit04
e172a8b08b
Hacktoberfest: Added first solution to Project Euler problem 58 (#3599)
* Added solution to problem 58

* Update sol1.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-29 10:03:55 +08:00
Simon Lammer
e20895a4ff
Implement the melkman anlgorithm for computing convex hulls (#2916)
* Implement the melkman anlgorithm for computing convex hulls

* Link melkman algorithm description

* Format melkman algorithm code

* Add type hints to functions

* Fix build errors
2020-10-29 08:46:16 +08:00
Abhinand C
fd7da5ff8f
Add IBM Qiskit References (#2561)
* Added IBM Qiskit References

* space

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-29 08:43:34 +08:00
Lewis Tian
4fa8c9d4b4
Update graphs/depth_first_search_2.py (#3799)
- update naming style to snake_case
- add type hints
2020-10-29 08:35:31 +08:00
Snimerjot Singh
aebf9bdaaf
Added reverse_letters.py (#3730)
* Added reverse_letters.py

* Update strings/reverse_letters.py

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

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-10-27 12:05:37 +08:00
John Law
a5aef147e9
Fix Project Euler Readme (#3754)
* Fix Project Euler Readme

* updating DIRECTORY.md

* Update CONTRIBUTING.md

* spacing

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-26 21:18:57 +05:30
Shabab Karim
95db17ce0f
Added two pointer solution for two sum problem (#3468) 2020-10-26 11:08:53 +01:00
Gaurav Chaudhari
9eefe681af
fixes: #2969 (#3756)
Signed-off-by: Gaurav Chaudhari <capristar02@gmail.com>
2020-10-26 08:09:33 +01:00
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
xcodz-dot
47199c123c
Update CONTRIBUTING.md (#3698)
* Update CONTRIBUTING.md

Needed to tell people so we do not receive any duplicate solution. Do not count this as hactoberfest-accepted

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

typo fix

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

* Update CONTRIBUTING.md

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-26 14:35:49 +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
Phil Bazun
1b5c1b8344
Add single bit manipulation operations. (#3284)
* Add single bit manipuation operations.

* fixup! Add single bit manipuation operations.

* Change wording.
2020-10-25 10:24:35 +01:00
Ayoub Chegraoui
3a191d9a7c
Add solution to Project Euler problem 81 (#3408)
* Add solution to problem 81 - project euler

* Update project_euler/problem_081/sol1.py

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

* Update project_euler/problem_081/sol1.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-25 09:36:31 +05:30
Michael D
98e9d6bdb6
Fix style of the first ten solutions for Project Euler (#3242)
* Fix style of the first ten solutions for Project Euler

- Unify the header docstring, and add reference URLs to wikipedia
  or similar
- Fix docstrings to be properly multilined
- Add newlines where appropriate
- Add doctests where they were missing
- Remove doctests that test for the correct solution
- fix obvious spelling or grammar mistakes in comments and
  exception messages
- Fix line endings to be UNIX. This makes two of the files seem
  to have changed completely
- no functional changes in any of the solutions were done
  (except for the spelling fixes mentioned above)

* Fix docstrings and main function as per Style Guide
2020-10-25 08:53:16 +05:30
Phil Bazun
5be77f33f7
Add 0-1-bfs. (#3285)
* Add 0-1-bfs.

* fixup! Add 0-1-bfs.

* fixup! Add 0-1-bfs.

* Check edge weights.

* Check edge vertecies.
2020-10-24 23:07:04 +02:00
Sam Holst
89e8dbffba
removed extra line to match rest of file (#3528) 2020-10-25 01:19:59 +08:00
Nandiya
12c69800bd
Forecast (#3219)
* add forecasting code

* add statsmodel

* sort import

* sort import fix

* fixing black

* sort requirement

* optimize code

* try with limited data

* sort again

* sort fix

* sort fix

* delete warning and black

* add code for forecasting

* use black

* add more hints to describe

* add doctest

* finding whitespace

* fixing doctest

* delete

* revert back

* revert back

* revert back again

* revert back again

* revert back again

* try trimming whitespace

* try adding doctypeand etc

* fixing reviews

* deleting all the space

* fixing the build

* delete x

* add description for safety checker

* deleting subscription integer

* fix docthint

* make def to use function parameters and return values

* make def to use function parameters and return values

* type hints on data safety checker

* optimize code

* Update run.py

Co-authored-by: FVFYK3GEHV22 <fvfyk3gehv22@FVFYK3GEHV22s-MacBook-Pro.local>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-24 16:07:27 +02:00
Dhruv Manilawala
b97529dd88
Move validate_solutions and add durations flag to pytest.ini (#3704)
* Move PE validate_solutions to scripts/ directory

* Update pytest.ini file with durations settings

* Remove codespell and autoblack workflow file

* Dependent changes to test config files

* Update pytest.ini
2020-10-24 19:07:33 +05:30
Du Yuanchao
1cd8e68537
Update LinkedQueue (#3683)
* update LinkedQueue

* add type hint and rename
2020-10-24 12:16:37 +02:00