Commit Graph

2702 Commits

Author SHA1 Message Date
Margaret
cbf3c6140a
add the dna algorithm (#6323)
* adding the dna algorithm

* following bot recommendations

following bot recommendations for the indentation

* following bot recommendations

following bot recommendations regarding indentation [ again ]

* following bot recommendations

following bot recommendations regarding indentation [ again. ]

* following bot recommendations

following bot recommendations.
2022-09-05 02:51:11 +01:00
zhexuanl
b1818af517
Add Digital Image Processing Algorithm: Local Binary Pattern (#6294)
* add algorithm local binary pattern

* fix failed test for local binary pattern

* updating DIRECTORY.md

* fix detected precommit-error

* fix precommit error

* final check

* Add descriptive name for parameters  x and y

* Update digital_image_processing/filters/local_binary_pattern.py

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

* Update digital_image_processing/filters/local_binary_pattern.py

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

* Update digital_image_processing/filters/local_binary_pattern.py

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

* Update local_binary_pattern.py

* undo changes made on get_neighbors_pixel()

* files formatted by black

* Update digital_image_processing/filters/local_binary_pattern.py

ok thanks

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

* add test for get_neighbors_pixel() function

* reviewed

* fix  get_neighbors_pixel

* Update test_digital_image_processing.py

* updating DIRECTORY.md

* Create code_quality.yml

* Create code_quality.yml

* Delete code_quality.yml

* Update code_quality.yml

* Delete code_quality.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-08-24 06:48:54 +02:00
AmirMohammad Hosseini Nasab
f31fa4ea7e
Fenwick Tree (#6319)
* Enhance fenwick_tree.py

* Change update to add in fenwick_tree.py

* Some changes

* Fix bug

* Add O(N) initializer to FenwickTree

* Add get method to Fenwick Tree

* Change tree in Fenwick Tree

* Add rank query to FenwickTree

* Add get_array method to FenwickTree

* Add some tests

* Update data_structures/binary_tree/fenwick_tree.py

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

* Update data_structures/binary_tree/fenwick_tree.py

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

* Update data_structures/binary_tree/fenwick_tree.py

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

* change `List` to `list`

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-08-16 19:38:33 +02:00
AmirMohammad Hosseini Nasab
f46ce47274
Add Max Fenwick Tree (#6298)
* Add `MaxFenwickTree`

* Reformat code style

* Fix type hints

* Fix type hints again

* Complete docstring

* Complete docstring

* Fix typo in file name

* Change MaxFenwickTree into 0-based indexing

* Fix Bugs

* Minor fix
2022-08-12 11:12:58 +02:00
Maxim Smolskiy
063a0eced9
feat: add Project Euler problem 115 solution 1 (#6303)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-08-07 16:50:45 +05:30
Maxim Smolskiy
a69d880bb5
feat: add Project Euler problem 114 solution 1 (#6300)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-08-07 07:37:35 +05:30
Horst JENS
9eac958725
typo corrected: heart -> Earth (#6275) 2022-08-06 17:47:56 +02:00
Maxim Smolskiy
defc205ef4
perf: improve Project Euler problem 203 solution 1 (#6279)
Improve solution (locally 1500+ times - from 3+ seconds to ~2 milliseconds)

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-08-06 19:34:24 +05:30
Maxim Smolskiy
97f25d4b43
feat: add Project Euler problem 587 solution 1 (#6269)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-26 21:45:14 +05:30
Maxim Smolskiy
90959212e5
perf: improve Project Euler problem 030 solution 1 (#6267)
Improve solution (locally 3+ times - from 3+ seconds to ~1 second)

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-25 22:11:12 +05:30
keshav Sharma
7d9ebee75f
chore: rename gcd to greatest_common_divisor (#6265)
As described in CONTRIBUTING.md

> Expand acronyms because gcd() is hard to understand but greatest_common_divisor() is not.

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-07-24 21:33:10 +05:30
lance-pyles
d53fdc29e2
chore: update .gitignore (#6263) 2022-07-23 07:56:59 +05:30
Maxim Smolskiy
c45fb3c294
perf: Project Euler problem 145 solution 1 (#6259)
Improve solution (~30 times - from 900+ seconds to ~30 seconds)

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-23 07:23:46 +05:30
U
b3d9281591
Add algorithm for creating Hamming numbers (#4992)
* Added algorithm for creating Hamming numbers series in Python

* Changed to f-string format.

* Added modifications

* Update and rename hamming.py to hamming_numbers.py

* Update hamming_numbers.py

* Update hamming_numbers.py

* Rename maths/series/hamming_numbers.py to maths/hamming_numbers.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-07-17 05:55:29 +08:00
KanakalathaVemuru
e1e7922efa
Add circle sort implementation (#5548)
* Added circle sort implementation

* Added modifications

* Added modifications

* Update circle_sort.py

* Update circle_sort.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-07-17 05:42:58 +08:00
Dhruv Manilawala
38dfcd28b5
fix: test failures (#6250)
1. Incorrect function was being imported from the module
2. Testing for exception was not done correctly
2022-07-14 12:54:24 +05:30
lakshmikanth ayyadevara
dcc387631d
Improve prime_check in math modules (#6044)
* improved prime_check

* updating DIRECTORY.md

* included suggested changes

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-11 23:29:27 +08:00
Nikos Giachoudis
f7c58e4c4b
Unify primality checking (#6228)
* renames prime functions and occurances in comments

* changes implementation of primality testing to be uniform

* adds static typing as per conventions

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-11 22:36:57 +08:00
Christian Clauss
dad789d903
Get rid of the Union (#6246)
* Get rid of the Union

* updating DIRECTORY.md

* Get rid of the Union

* Remove the redundant pre-commit runs.

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-11 13:11:17 +02:00
Todor Peev
ba129de7f3
Fixes: 6216 | Support vector machines (#6240)
* initial commit

* first implementation of hard margin

* remove debugging print

* many commits squashed because pre-commit was buggy

* more kernels and improved kernel management

* remove unnecessary code + fix names + formatting + doctests

* rename to fit initial naming

* better naming and documentation

* better naming and documentation
2022-07-11 12:42:07 +02:00
Christian Clauss
b75a7c77f8
pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0 (#6245)
* pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0

* pre-commit run --all-files
2022-07-11 10:19:52 +02:00
Vardhaman
2d5dd6f132
MAINT: Updated f-string method (#6230)
* MAINT: Used f-string method

Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.

* Updated files with f-string method

* Update rsa_key_generator.py

* Update rsa_key_generator.py

* Update elgamal_key_generator.py

* Update lru_cache.py

I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.

* Update lru_cache.py

* Update lru_cache.py

Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-07-07 16:34:07 +02:00
Christian Clauss
0a0f4986e4
Upgrade GitHub Actions (#6236)
* Upgrade GitHub Actions

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-07 05:25:25 +02:00
John Law
9135a1f411
Fix doctests and builds in various files (#6233)
* Fix doctest in hamming distance

* add line break

* try to fix quantum_riper_adder

* fix floating point build
2022-07-06 10:00:05 +02:00
Sedat Aybars Nazlica
89fc7bf0b0
Add hamming distance (#6194)
* Add hamming distance

* Fix doctest

* Refactor

* Raise ValueError when string lengths are different
2022-07-06 15:19:13 +08:00
lovetodevelop
e5d1ff2ea8
Fix tiny spelling error (#6219) 2022-07-04 00:28:53 +08:00
Erik Parmann
4a51244e0f
Remove how-to example for support vector machine (#6201) 2022-06-24 01:00:55 +08:00
Margaret
04bc8f01dd
Wave (#6061)
* Added censor function

* Added censor code

* Added comments to the code

* modified censor function

* added decrypt function

* added cypher and decypher functions, deleted censor and decrypt functions

* Deleted decrypt.py

* Deleted censor.py

* edited the crypt and decrypt files

* Update cypher_txt.py

* Remove the endline in cypher.py

* Removed the print at the end of decypher.py

* added 4 new algorithms

* added tests to the four files

* added type hints for the function variables

* Deleted decode message

* Deleted code message

* Welford average algorithm

* added average welford algorithm

* is_narcissistic added

* added a descriptive name

* added max_sectors algorithm

* added find_unique

* added wave algorithm

* deleting average_welford [ in the wrong pr ]

* deleting is_narcissistic [ is in the wrong pr ]

* deleting max_sectors [ is in the wrong pr ]

* deleting find_unique [ is in the wrong pr ]

* deleting censor [ is in the wrong pr ]

* deleting decrypt [ is in the wrong pr ]

* fixed wave.py 

fixed indentation and followed the bots reccomendations

* fixed wave.py again

* fixing wave.py for the third time.

* fixing wave.py

* merging strings/wave.py

merging the suggestion

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

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-06-24 00:47:29 +08:00
yulmam
a80e5aadf3
add highest_response_ratio_next.py (#6183)
* add highest_response_ratio_next.py

* Update highest_response_ratio_next.py

* Update highest_response_ratio_next.py
2022-06-22 12:23:52 +08:00
Nivid Patel
42a80cdaf6
Update basic_maths.py (#6017) 2022-06-22 12:04:18 +08:00
Vcrostin
69cde43ca1
make DIRECTORY.md paths relative Fixes (#6179) (#6190) 2022-06-22 12:01:05 +08:00
이빈
c86aa72cfa
Create non_preemptive_shortest_job_first.py (#6169)
* Create non_preemptive_shortest_job_first.py

* 파일 위치 변경

* Delete non_preemptive_shortest_job_first.py

* delete Korean comments

* change comments, & to and, type annotation

* type annotation

* delete unnecessary comment
2022-06-07 00:44:49 +08:00
DongJoon Cha
a44afc9b7d
Add Multi-Level-Feedback-Queue scheduling algorithm (#6165)
* Add Multi-Level-Feedback-Queue scheduling algorithm

* fix type hint annotation for pre-commit

* Update scheduling/multi_level_feedback_queue.py

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

* Update scheduling/multi_level_feedback_queue.py

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

* Update scheduling/multi_level_feedback_queue.py

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

* Update scheduling/multi_level_feedback_queue.py

* Update scheduling/multi_level_feedback_queue.py

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

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-06-05 00:41:52 +08:00
kugiyasan
8004671b98
Add Project Euler 68 Solution (#5552)
* updating DIRECTORY.md

* Project Euler 68 Solution

* updating DIRECTORY.md

* Project Euler 68 Fixed doctests, now at 93% coverage

* Update sol1.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: kugiyasan <kugiyasan@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-27 03:24:23 +08:00
Raine Legary
b8fdd81f28
Add minmum path sum (#5882)
* commit on 'shortest_path_sum'

* minimum_path_sum updated

* commit to 'minimum_path_sum'

* added description to minimum_path_sum

* bot requirements fixed for

* Update minimum_path_sum.py

* Update minimum_path_sum.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-25 13:49:54 +08:00
Maxim Smolskiy
de4d98081b
Improve Project Euler problem 145 solution 1 (#6141)
* updating DIRECTORY.md

* Improve solution

* updating DIRECTORY.md

* Fix

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-05-24 09:20:47 +08:00
Luke Banicevic
a28ad3f759
Add Microsoft Excel Column Title to Column Number Conversion (#4849)
* Added excel column title to number algorithm as part of conversions

* Renamed file to better reflect algorithm function

* Removed duplicate file

* Update excel_title_to_column.py

* Update excel_title_to_column.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-24 09:18:50 +08:00
dangbb
5bac76d7a5
Fix iter_merge_sort bug (#6153)
* Fixed bug where array length 2 can't be sorted

* Add MCC and DU path test

Add test to conversions/octal_to_decimal.py and sorts\iterative_merge_sort.py

* ""

* Update octal_to_decimal.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-21 22:02:53 +08:00
Ikko Ashimine
dceb30aad6
Fix typo in word_occurrence.py (#6154)
word_occurence -> word_occurrence
2022-05-20 12:03:54 +08:00
Aviv Faraj
ec54da34b9
Lorenz transformation - physics (#6097)
* Add files via upload

* Changed print to f-string

Also printed out results in a math notation

* Add files via upload

* Fixes: #4710 provided return type

* File exists in another pull request

* imported radians from math

* Updated file according to pre-commit test

* Updated file

* Updated gamma

* Deleted duplicate file

* removed pi

* reversed tests

* Fixed angle condition

* Modified prints to f-string

* Update horizontal_projectile_motion.py

* Update horizontal_projectile_motion.py

* Fixes #4710 added exceptions and tests

* Added float tests

* Fixed type annotations

* Fixed last annotation

* Fixed annotations

* fixed format

* Revert "fixed format"

This reverts commit 5b0249ac0a.

Undo changes
@wq

* Revert "Fixed annotations"

This reverts commit c37bb95408.

* Revert "Fixed last annotation"

This reverts commit e3678fdead.

* Revert "Fixed type annotations"

This reverts commit 3f2b238c34.

* Revert to 4e2fcaf6fb

* Fixing errors found during pre-commit

* Added gauss law

* Implemented Lorenz tranformation with four vector

* pre-commit fixes

* flake8 fixes

* More flake8 fixes

* Added blank space for flake8

* Added reference

* Trailing whitespace fix

* Replaced argument u with velocity (descriptive name fix)

* Added tests for functions + moved velocity check to beta function

* Modified condition to 'not symbolic' in the transform function

* trainling whitespace fix

* Added type hint for 'smybolic' argument in transform function

* Changed reference to avoid pre-commit fails because of spelling issue related to the URL

* Added tests for gamma and transformation_matrix functions

* Fixed transformation_matrix tests

* Fixed tests on beta and gamma functions
2022-05-16 22:26:19 +08:00
zer0-x
80f1da235b
Add sin function to maths (#5949)
* Add sin function to /maths.

* Fix typo in /maths/sin.py

* Format sin.py to meet the new black rules.

* Some improvements.

* Fix a formating error.
2022-05-16 19:28:30 +08:00
Omkaar
dbee5f072f
Improve code on f-strings and brevity (#6126)
* Update strassen_matrix_multiplication.py

* Update matrix_operation.py

* Update enigma_machine2.py

* Update enigma_machine.py

* Update enigma_machine2.py

* Update rod_cutting.py

* Update external_sort.py

* Update sol1.py

* Update hill_cipher.py

* Update prime_numbers.py

* Update integration_by_simpson_approx.py
2022-05-13 20:51:44 +08:00
Rohan R Bharadwaj
e95ecfaf27
Add missing type annotations for strings directory (#5817)
* Type annotations for `strings/autocomplete_using_trie.py`

* Update autocomplete_using_trie.py

* Update detecting_english_programmatically.py

* Update detecting_english_programmatically.py

* Update frequency_finder.py

* Update frequency_finder.py

* Update frequency_finder.py

* Update word_occurrence.py

* Update frequency_finder.py

* Update z_function.py

* Update z_function.py

* Update frequency_finder.py
2022-05-13 13:55:53 +08:00
eee555
bbb88bb5c2
Fix bug in bucket_sort.py (#6005) 2022-05-13 04:28:51 +08:00
Maxim Smolskiy
562cf31a9a
Improve Project Euler problem 074 solution 2 (#5803)
* Fix statement

* Improve solution

* Fix

* Add tests
2022-05-12 11:48:04 +08:00
Leoriem-code
533eea5afa
fix mypy annotations for arithmetic_analysis (#6040)
* fixed mypy annotations for arithmetic_analysis

* shortened numpy references
2022-05-12 11:35:56 +08:00
Omkaar
e23c18fb5c
Fix typos (#6127) 2022-05-12 11:30:00 +08:00
KerimovEmil
3bff196981
Fix some typos in solution 1 of euler 686 (#6112)
While reading this code I noticed some typos in the doc strings and wanted to fix them.
2022-05-12 11:28:45 +08:00
Simon
8226636ea3
Add the Horn-Schunck algorithm (#5333)
* Added implementation of the Horn-Schunck algorithm

* Cleaner variable names

* added doctests

* Fix doctest

* Update horn_schunck.py

* Update horn_schunck.py

* Update horn_schunck.py

* Update horn_schunck.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-03 00:07:29 +08:00
Kunwar Preet Singh
26f2df7622
Add sol for P104 Project Euler (#5257)
* Hacktoberfest: added sol for P104 Project Euler

* bot requests resolved

* pre-commit

* Update sol.py

* Update sol.py

* remove trailing zeroes

* Update sol.py

* Update sol.py

* Update sol.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-02 22:12:18 +08:00