Commit Graph

2164 Commits

Author SHA1 Message Date
Grigoriy Hanin
40e357f688
Mistake in maths/average_mode.py fixed. (#4464)
A serious bug was addressed with this pull request. The mode function previously
didn't return the mode of the input list. Instead, it always returned the first value.
Due to lacking tests, the bug was never caught. This pull request also adds new
functionality to the function, allowing support for more than one mode.

See #4464 for details.

* * Mistake in average_mode.py fixed. The previous solution was to returnthe
value on the first loop iteration, which is not correct, more than that it
used to delete repeating values, so result's array and check array lost
relation between each other

* Type hint added

* redundant check_list deleted

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Suggestions resolved

* output typing changed to Any
* test cases added

* Black done

File formatted

* Unused statistics import

statistics only used in doctest, now they are imported in doctest

* Several modes support added

Several modes support added

* Comment fix

* Update maths/average_mode.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Suggestions added

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
2021-06-04 15:16:32 -05:00
Lakshay Akula
cb0a5480a7
Add catalan_numbers.py (#4455)
Reviewed by @mrmaxguns. This is an implementation of Catalan Numbers.
2021-05-31 19:55:01 -05:00
Christian Clauss
71b458cefe
Rename harriscorner.py to harris_corner.py (#4470)
* Rename harriscorner.py to harris_corner.py

* updating DIRECTORY.md

* Rename meanthreshold.py to mean_threshold.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-05-31 21:19:09 +05:30
Vivian Dai
04f156a897
markdown consistency (#4461)
* markdown consistency

* Swap ** for __

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-05-31 10:56:11 +02:00
Grigoriy Hanin
b3b89d9460
Armstrong number definition fix (#4466)
This is a documentation fix. This fix patches a mistake in the description of the Armstrong number.

* * Doc fix

* Armstrong number is not the sum of cube's of number digits, but
the sum of number's digits each raised to the power of the number of digits

* Update armstrong_numbers.py

Line shorten
2021-05-30 18:41:07 -05:00
Benjamin Fein
650039a279
Add a recursive merge sort algorithm that accepts an array as input. (#4462)
This is a different recursive implementation of the merge sort algorithm.

* Recursive Merge Sort That Accepts an Array 

Recursive Merge Sort That Accepts an Array

* Add Wikipedia Link

* Fixes naming conventions

* Update sorts/recursive_mergesort_array.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Update sorts/recursive_mergesort_array.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Update sorts/recursive_mergesort_array.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Update sorts/recursive_mergesort_array.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Update sorts/recursive_mergesort_array.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Adds black format

* Removes unused variables

* Fixes variable names and adds documentation

* Fixes variable names to use snake_case.

* Removes double #.

* Update sorts/recursive_mergesort_array.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
Co-authored-by: Benjamin Fein <benfein78@icloud.com>
2021-05-30 10:27:42 -05:00
Tobias
b913a0d83a
Implemented MSD radix sort algorithm in-place (#4449)
* Implemented MSD radix sort algorithm inplace

* Fixed formatting
2021-05-24 22:36:57 +02:00
Dhruv Manilawala
32e9072627
fix(action): testing and fixing errors (#4446)
* fix(action): testing and fixing errors

* fix: testing if all is a valid entry for workflows

* fix: more events to trigger workflow tests

* fix: double quotes -> single quotes

* fix: add workflows name to the list

* revert: remove added events

This reverts commit 3daeeb2ba3
2021-05-21 19:25:59 +05:30
Dhruv Manilawala
ac29f70755
fix(action): correct indentation for types key (#4445)
* fix(action): correct indentation for types key

* updating DIRECTORY.md

* refactor: add quotes around name key

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-05-21 19:03:56 +05:30
Dhruv Manilawala
92836d57f6
feat: action to approve workflow run (#4444) 2021-05-21 14:31:56 +05:30
Tobias
b11e5314b7
Added implementation for MSD radix sort algorithm based on binary representation (#4441)
* Added MSD radix sort algorithm

* Fixed typos

* Added doctests

* Added link to wikipedia

* Added doctest and improved code
2021-05-20 21:15:51 +02:00
TANMAY SRIVASTAVA
368ce7aecc
Added a hex-bin.py file in conversion.py (#4433)
* Added a file that converts hexa to binary

* Added file to convert hexadecimal to binary

* Update hex-bin.py

* added type hint in the code

* Added doctest

* Added code to handle exception

* Resolved doctest issue

* Update hex-bin.py

* Modified convert function

* Added WhiteSpace around operators.

* Made more pythonic

* removed whitespace

* Updated doctest command

* Removed whitespace

* imported union

* Replaced flag with is_negative

* updated return type

* removed pip command

* Resolved doctest issue

* Resolved doctest error

* Reformated the code

* Changes function name

* Changed exception handling statements

* Update and rename hex-bin.py to hex_to_bin.py

* Update newton_method.py

* Update matrix_operation.py

* Update can_string_be_rearranged_as_palindrome.py

* Update hex_to_bin.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-05-20 10:28:00 +02:00
Cere Blanco
8d173438c3
Bit manipulation: get the bit at a given position (#4438) 2021-05-18 20:24:34 +05:30
Jenil Shah
7d7c7972ae
Updated name from lstm_prediction.py_tf to lstm_prediction.py and also imported keras (#4422)
* Updated name from lstm_prediction.py_lf to lstm_prediction.py and also imported keras

* Edited the changes

* tensorflow 2.5 is has shipped!!!

* Update lstm_prediction.py

* Update lstm_prediction.py

* One blank line, not two?

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-05-17 14:28:04 +02:00
onlinejudge95
002c545aee
Removes python_version condition on tensorflow (#4435) 2021-05-17 13:58:51 +02:00
The Data Lady
4ab39c2001
Removed keras dependency from requirements.txt (#4374) 2021-05-17 17:06:14 +05:30
Malte Jürgens
03d9b6747b
feat(ci): Hash project euler solutions (#4411)
* hash project euler solutions

* fix errors

* Return missing annotation

* Fix typo

* Extract variable to shorten excessively long line

* Update scripts/validate_solutions.py

* Update scripts/validate_solutions.py

* Simplify with str.encode()

* PEP 585: type hinting generics in standard collections;

* str().encode()

* Texas two step to placate black, flake8, mypy

Co-authored-by: Andrii Siriak <siryaka@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-05-12 09:48:23 +02:00
Ahmed Haj Abdel Khaleq
deb71167e7
[mypy] Fix type annotations for linked_stack.py, evaluate_postfix_notations.py, stack.py in data structures (#4409)
* [mypy] Fix type annotations for linked_stack.py, next_greater_element.py, stack.py

* Reformatted files according to black
2021-05-12 08:22:42 +02:00
ngxingyu
727341e3db
Create check_pangram.py (#4389) 2021-05-04 08:49:41 +02:00
Dhruv Manilawala
6f21f76696
fix(ci): Update pre-commit hooks and apply new black (#4359)
* fix(ci): Update pre-commit hooks and apply new black

* remove empty docstring
2021-04-26 07:46:50 +02:00
Christian Clauss
69457357e8
binary_tree_traversals.py: Simplify with dataclasses (#4336)
* binary_tree_traversals.py: Simplify with dataclasses

* Update data_structures/binary_tree/binary_tree_traversals.py

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

* Optional["Node"]

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2021-04-26 10:15:26 +05:30
David Leal
2ce6be009a
feat: Add Discord badge in README.md (#4357)
* feat: Add Discord badge in `README.md`

* Update README.md

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2021-04-26 10:01:34 +05:30
algobytewise
1a39970538
Add rgb_hsv_conversion.py (#4334)
* Add rgb_hsv_conversion.py

* updating DIRECTORY.md

* snake-case

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-04-23 08:24:01 +02:00
Christian Clauss
ba974810d6
Simplify password_generator() (#4333) 2021-04-22 14:22:54 +05:30
Oliver Dewitz
cbe4d5f952
Fixed typo in docstring (#4326) 2021-04-12 13:40:10 +02:00
Christian Clauss
252df0a149
fix(mypy): Fix files in scripts/ (#4320) 2021-04-07 08:12:56 +05:30
algobytewise
531d2d6d7e
Mypy fix rotation.py (#4319)
* fix type-hints arguments

* fix matrices & image-path

* Update build.yml

* Revert "Update build.yml"

This reverts commit c2d04aef65.

* use pathlib

* feat: Add mypy configuration file (#4315)

* feat: Add mypy config file

* refactor: Remove mypy options from build workflow

* Remove linear_algebra

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

* rebase & update mypy.ini

* fix pre-commit errors

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-04-06 15:34:18 +02:00
Dhruv Manilawala
c49fa088a0
feat: Add mypy configuration file (#4315)
* feat: Add mypy config file

* refactor: Remove mypy options from build workflow

* Remove linear_algebra

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-04-06 12:54:26 +02:00
Dhruv Manilawala
8c2986026b
fix(mypy): type annotations for linear algebra algorithms (#4317)
* fix(mypy): type annotations for linear algebra algorithms

* refactor: remove linear algebra directory from mypy exclude
2021-04-05 15:37:38 +02:00
Dhruv Manilawala
20c7518028
fix(mypy): type annotations for conversions algorithms (#4314)
* fix(mypy): type annotations for conversions algorithms

* refactor(CI): include conversions algorithms for mypy tests
2021-04-04 15:25:49 +02:00
algobytewise
536fb4bca4
Add algorithm for N-body simulation - retry (#4298)
* add n_body_simulation.py

* updating DIRECTORY.md

* Rename other/n_body_simulation.py to physics/n_body_simulation.py

* updating DIRECTORY.md

* Update build.yml

* refactor examples & add doctests

* removed type-hints from self-parameter

* Apply suggestions from code review

* Update physics/n_body_simulation.py

* Update physics/n_body_simulation.py

* Update physics/n_body_simulation.py

* Don't forget self

* Fix velocity

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-04-04 13:23:48 +02:00
Dhruv Manilawala
60895366c0
fix(mypy): type annotations for cipher algorithms (#4306)
* fix(mypy): type annotations for cipher algorithms

* Update mypy workflow to include cipher directory

* fix: mypy errors in hill_cipher.py

* fix build errors
2021-04-04 07:22:12 +02:00
Elisha Hollander
806b3864c3
refactor: Remove default value of exponential_term (#4308)
exponential_term doesn't need a default value
2021-04-04 09:32:36 +05:30
Elisha Hollander
0992498a10
refactor: Remove unnecessary if else condition (#4307)
All the operation is being done in an else condition for "if number >= 0"
2021-04-04 09:30:17 +05:30
Elisha Hollander
e7e6cbfb8f
refactor: Remove "redefinition" of dict element (#4309) 2021-04-04 09:25:57 +05:30
algobytewise
a53fcf221b
[mypy] fix hashes folder (#4305)
* fix hashes-folder

* Update build.yml

* fix doctests

* return-values to int

* Update hashes/adler32.py

* type hints for elements

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-04-03 13:31:46 +05:30
algobytewise
5229c74955
[mypy] Fix directory arithmetic_analysis (#4304)
* fix directory arithmetic_analysis

* Update build.yml

* temporary fix for psf/black bug

see https://github.com/psf/black/issues/2079

* Update in_static_equilibrium.py
2021-04-02 09:32:12 +02:00
Christian Clauss
895bca3654
[mypy] Fix web_programming directory (#4297)
* Update world_covid19_stats.py

* Delete monkeytype_config.py

* updating DIRECTORY.md

* Apply pyannotate suggestions to emails_from_url.py

* mypy web_programming/emails_from_url.py

* super().__init__()

* mypy --ignore-missing-imports web_programming/emails_from_url.py

* Update emails_from_url.py

* self.urls: list[str] = []

* mypy: Fix web_programming directory

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2021-03-31 08:48:07 +05:30
Christian Clauss
c22c7d503b
mypy: Use a --exclude list (#4296)
* mypy: Use a --exclude list

* Graphics works on my machine

* A few more...

* A few more...

* Update build.yml
2021-03-31 08:32:25 +05:30
algobytewise
35901eb6fe
Move: traversals/binary_tree_traversals.py --> searches/binary_tree_traversal.py (#4295)
* Rename traversals/binary_tree_traversals.py to searches/binary_tree_traversal.py

* updating DIRECTORY.md

* Delete traversals directory

* Update build.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-27 10:18:48 +01:00
algobytewise
9b60be67af
[mypy] fix small folders 2 (#4293)
* Update perceptron.py

* Update binary_tree_traversals.py

* fix machine_learning

* Update build.yml

* Update perceptron.py

* Update machine_learning/forecasting/run.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-26 12:21:16 +01:00
algobytewise
959507901a
[mypy] fix small folders (#4292)
* add final else-statement

* fix file_transfer

* fix quantum folder

* fix divide_and_conquer-folder

* Update build.yml

* updating DIRECTORY.md

* Update ripple_adder_classic.py

* Update .github/workflows/build.yml

* removed imports from typing

* removed conversion to string

* Revert "removed conversion to string"

This reverts commit 2f7c4731d1.

* implemented suggested changes

* Update receive_file.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-23 16:51:50 +01:00
algobytewise
a8db5d4b93
[mypy] fix compression folder (#4290)
* Update lempel_ziv.py

* Update build.yml

* updating DIRECTORY.md

* fix doctest in 2_hidden_layers_neural_network.py

* one more doctest

* simplified tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-22 19:24:05 +01:00
algobytewise
0ee8f792e3
Moved "other/anagrams.py" to the string folder (#4289)
* move&rename, changed code accordingly

* adjusted codespell ignore-list
2021-03-22 11:40:23 +01:00
algobytewise
ce99859ad5
Move files to various folders (#4286)
* Move files to cellular_automata

* Rename other/davis–putnam–logemann–loveland.py to backtracking/davis–putnam–logemann–loveland.py

* Rename other/markov_chain.py to graphs/markov_chain.py

* undid rename: need to fix mypy first
2021-03-22 10:54:04 +01:00
algobytewise
8d51c2cfd9
move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
Dhruv Manilawala
14bcb580d5
fix(mypy): Fix annotations for 13 cipher algorithms (#4278)
* Initial fix for mypy errors in some cipher algorithms

* fix(mypy): Update type hints

* fix(mypy): Update type hints for enigma_machine2.py

* Update as per the suggestion

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-22 07:59:51 +01:00
algobytewise
99a42f2b58
Move files to strings folder (#4283)
* Move files to strings-folder

* moved the file "words" back to the original folder

* moved "anagram.py" also back

* fix the codespell ignore-list
2021-03-21 12:05:10 +01:00
Novice :)
2c6f553ccb
[mypy] Fix type annotations for cellular_automata (#4236)
* [mypy] Fix type annotations for cellullar_automata

* mypy --ignore-missing-imports

* mypy --ignore-missing-imports

* Blank lines

* Blank lines

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-20 07:32:16 +01:00
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