Commit Graph

2618 Commits

Author SHA1 Message Date
Du Yuanchao
d6bff5c133
Renamed files and fixed Doctest (#2421)
* * Renamed files
* Fiexed doctest

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-13 13:27:20 +02:00
Hasenn
20e98fcded
Fix some warnings from LGTM (#2420)
* fix assignment of a variable to itself

* Fix unnecessary 'else' clause in loop

* formatting and redundant reasignment fix

* mark unreachable code with a TODO comment

* fix variable defined multiple times

* fix static method without static decorator

* revert unintended autoformatting

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

* revert autoformatting issue

* applied black autoformatting

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 10:11:27 +02:00
Guillaume Rochedix
f754c0d31f
Jump search (#2415)
* jump_search: doctest, docstring, type hint, inputs

* jumpsearch.py: case number not found

* trailing whitespace jump search
2020-09-12 07:50:12 +02:00
Meysam
2e790ce4ca
file-transfer: writing tests and ensuring that all is going well (#2413)
* file-transfer: writing tests and ensuring that all is going well

* def send_file(filename: str = "mytext.txt", testing: bool = False) -> None:

* send_file(filename="mytext.txt", testing=True)

* Update send_file.py

* requirements.txt: lxml

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 23:13:43 +02:00
Santosh Mohan Rajkumar
c676956030
lxmlCovidDataFetch (#2416)
* lxmlCovidDataFetch

* lxmlCovidDataFetch1

* Update worldometers_covid_with_lxml.py

* Rename worldometers_covid_with_lxml.py to covid_stats_via_xpath.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 22:25:05 +02:00
Marcos Cannabrava
a191f89fe2
Fix Non Recursive Depth First Search (#2207)
* Fix Non Recursive Depth First Search

* Unindent docstring

* Reindent docstring by 1 space

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 16:23:26 +02:00
mohammadreza490
1b3fec3f1f
binary_to_decimal converter (#2400)
* Create binary_to_decimal

binary to decimal converter

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 06:16:43 +02:00
mohammadreza490
696cd47e15
octal_to_decimal converter (#2399)
* Create octal_to_decimal

octal to decimal converter

* Update octal_to_decimal

* Update conversions/octal_to_decimal

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-10 10:37:29 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
Tanuj Dhiman
25946e4570
Update scoring_functions.py (#2291)
* Update scoring_functions.py

We can find accuracy by manually if we are not going to use sklearn library.

* Update scoring_functions.py

* Update machine_learning/scoring_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-09 19:04:46 +02:00
NEERAJ ADITYANANTH POLAMPALLI
c0dcc556b3
Update triplet_sum.py (#2404) 2020-09-06 10:40:46 +02:00
NEERAJ ADITYANANTH POLAMPALLI
3b1c4f72ce
changed a typo (#2396) 2020-09-05 13:09:18 +02:00
mohammadreza490
1385e47c36
Create hexadecimal_to_decimal (#2393)
* Create hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

Added negative hexadecimal conversion to decimal number

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

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

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-04 15:48:44 +02:00
mohammadreza490
c38dec091f
capitalize (#2389)
* Create capitalize.py

This function will capitalize the first character of a sentence or a word

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update capitalize.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-03 16:11:23 +02:00
Shubham Shaswat
a1d1a44f51
added idf-smooth (#2174)
* added idf-smooth

* added idf-smooth

* added idf-smooth
2020-09-02 19:33:12 +02:00
Muskan Kumar
e92e433dbe
Update CONTRIBUTING.md (#2378)
* Update CONTRIBUTING.md

fixed dead link to the license

* Update README.md

Added License

* Update README.md

* Update README.md

* Update README.md

* Update CONTRIBUTING.md

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-31 21:34:44 +02:00
小么小儿郎EL
80daa5750a
Fix bugs and add related tests (#2375) 2020-08-31 18:55:56 +02:00
kanthuc
472f63eaa5
Adding type hints to RedBlackTree (#2371)
* redblacktree type hints

* fixed type hints to pass flake8
2020-08-30 21:22:36 +02:00
Björn Olsson Jarl
8c191f1fc9
Added type hints for maths/fibonacci_sequence_recursion. (#2372) 2020-08-30 10:51:45 +02:00
Björn Olsson Jarl
ab5a046581
Added type hints and doctest for maths/prime_check. (#2367)
* Added type hints and doctest for maths/prime_check.

* Removed doctests.
2020-08-29 17:11:02 +02:00
Kushagra Bansal
f2f0425357
Created ugly_numbers.py in Python/maths (#2366)
* Add files via upload

* Update ugly_numbers.py

* Update ugly_numbers.py

* Update ugly_numbers.py
2020-08-29 16:57:34 +02:00
Aanuoluwapo Babajide
1f5134b368
Create alternate_disjoint_set.py (#2302)
* Create alternate_disjoint_set.py

This code implements a disjoint set using Lists 
with added heuristics for efficiency
Union by Rank Heuristic and Path Compression

* Update alternate_disjoint_set.py

Added typehints, doctests and some suggested variable name change

* Update alternate_disjoint_set.py

* Formatted with Black

* More formatting

* Formatting on line 28

* Error in Doctest

* Doctest Update in alternate disjoint set

* Fixed build error

* Fixed doctest
2020-08-28 18:25:02 +02:00
Kushagra Bansal
5ef784331e
Created triplet_sum in Python/other (#2362)
* Add files via upload

* Update triplet_sum.py

* Update triplet_sum.py

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update triplet_sum.py

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-28 15:50:35 +02:00
Kushagra Bansal
194b56d376
Created problem_63 in project_euler (#2357)
* Create __init__.py

* Add files via upload

* Update project_euler/problem_63/sol1.py

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-27 13:40:03 +02:00
wuyudi
cf385ad7ef
Update merge_sort.py (#2356)
* Update merge_sort.py

* Update merge_sort.py
2020-08-27 09:45:03 +02:00
Firejay3
61dde44434
Added binery_or_operator.py to bit manipulation file (#2331)
* added bitwise binary OR operator

* Rename binary_OR_operator.py to binary_or_operator.py

* Update binary_or_operator.py

* Update binary_or_operator.py

* Update bit_manipulation/binary_or_operator.py

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

* Update binary_or_operator.py

* Update binary_or_operator.py

* Nice!!

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-27 09:09:42 +02:00
TrapinchO
30126c26dd
Added enigma machine emulator (#2345)
* Added Enigma machine file

Added Enigma machine file to 'ciphers' section

* Added doctest to validator

* Fixed typo

* Shortened some lines

* Shortened some lines

* Update enigma_machine.py

* Shortened some lines

* Update enigma_machine.py

* Update enigma_machine.py

* Update enigma_machine2.py

* Update enigma_machine2.py

* added f-strings

* Update enigma_machine2.py

* Update enigma_machine2.py

* Updated some numbers

* Plugboard improvement

Added option to separate pair for plugboard by spaces

* renamed variable

* renamed some variables

* improved plugboard exception

* Update enigma_machine2.py

* Update enigma_machine2.py
2020-08-26 21:52:17 +02:00
Kushagra Bansal
9aa10ca358
Created problem_55 in project_euler (#2354)
* Create __init__.py

* Add files via upload

* Update sol1.py
2020-08-26 13:31:13 +02:00
Iheb Haboubi
2c0127d71a
Perfect square using binary search (#2351)
* Add perfect_square_binary_search

* Update tests

* Add tests
2020-08-25 21:26:11 +02:00
Christian Clauss
ee914c751c
Delete sleep_sort.py (#2352)
* Delete sleep_sort.py

A silly algorithm designed to waste time.  #2350 demonstrates that it is a 20+ second denial of service attack on every Travis CI run that we do.

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-25 15:48:04 +02:00
Christian Clauss
e77600638d
Travis CI: Identify our ten slowest pytests (#2350)
* Travis CI: Identify our ten slowest tests

https://howchoo.com/g/mtblodnjzjc/how-to-measure-unit-test-execution-times-in-pytest helps us to find the individual tests that are slowing down our Travis CI checks.

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-25 15:47:06 +02:00
Kushagra Bansal
402ba7f49a
Created problem_45 in project_euler and Speed Boost for problem_34/sol1.py (#2349)
* Create __init__.py

* Add files via upload

* Update sol1.py

* Update sol1.py

* Update project_euler/problem_45/sol1.py

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

* Update sol1.py

* Update sol1.py

* Update project_euler/problem_34/sol1.py

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

* Update project_euler/problem_34/sol1.py

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

* Update sol1.py

* Update project_euler/problem_34/sol1.py

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

* Update sol1.py

* Update project_euler/problem_34/sol1.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-25 13:48:19 +02:00
Kushagra Bansal
5cfc017ebb
Created problem_44 in project_euler (#2348)
* Create __int__.py

* Update and rename project_euler/__int__.py to project_euler/problem_44/__int__.py

* Add files via upload

* Update sol1.py

* Update __int__.py

* Delete __int__.py

* Create __init__.py

* Update project_euler/problem_44/sol1.py

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

* Update project_euler/problem_44/sol1.py

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

* Update project_euler/problem_44/sol1.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-25 09:46:13 +02:00
kanthuc
f8c57130f2
lazy_segment_tree.py-style-fixes (#2347)
* fixed variable naming and unnecessary type hints

* print(segt)

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-24 09:52:02 +02:00
BAKEZQ
d402cd0b6e
Fix SettingWithCopy warning by pandas (#2346)
* Fix SettingWithCopy warning in pandas

https://github.com/TheAlgorithms/Python/issues/2282

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py
2020-08-23 13:40:57 +02:00
Guillaume Rochedix
ee28deea4a
Insertion sort : type hint, docstring (#2327)
* insertion sort : docstring, type hinting

* Update insertion_sort.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-23 04:35:54 +02:00
Kaif Kohari
a46b5559e0
Job fetching (#2219)
* Adding job scarping algorithm to web programming

* Delete fetch_jobs.py

* Adding Jobs Scraping to web programming

* Add Python type hints

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-21 23:58:26 +02:00
wuyudi
6822d1afeb
Update matrix_operation.py (#2344)
* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py
2020-08-21 20:41:48 +02:00
Kushagra Bansal
ae33419c12
Created problem_46 in project_euler (#2343)
* Create __init__.py

* Add files via upload

* Update sol1.py

* Update sol1.py

* Update project_euler/problem_46/sol1.py

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

* Update project_euler/problem_46/sol1.py

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

* Update sol1.py

* exact

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-21 14:09:55 +02:00
SiddhantBobde
0bf1f22d37
Added function for finding K-th smallest element in BST (#2318)
* fixes: #2172

* fixes: #2172

* Added docstrings and type of parameters

* fixed error

* Added type hints

* made changes

* removed capital letters from function name

* Added type hints

* fixed bulid error

* modified comments

* fixed build error
2020-08-21 12:25:50 +05:30
Du Yuanchao
0591968947
Optimization and fix bug (#2342)
* * optimization aliquot_sum
* fix bug in average_median

* fixup! Format Python code with psf/black push

* Update maths/average_median.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-21 14:39:03 +08:00
kanthuc
2eaacee7b4
lowest_common_ancestor.py static type checking (#2329)
* adding static type checking to basic_binary_tree.py

* Add static type checking to functions with None return type

* Applying code review comments

* Added missing import statement

* fix spaciing

* "cleaned up depth_of_tree"

* Add doctests and then streamline display() and is_full_binary_tree()

* added static typing to lazy_segment_tree.py

* added missing import statement

* modified variable names for left and right elements

* added static typing to lowest_common_ancestor.py

* fixed formatting

* modified files to meet style guidelines, edited docstrings and added some doctests

* added and fixed doctests in lazy_segment_tree.py

* fixed errors in doctests

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-21 06:54:34 +02:00
Alex Joslin
d3199da000
Created Dijkstra's Two Stack Algorithm (#2321)
* created dijkstra's two stack algorithm

* Made changes to dijkstras two stack algorithm for documentation and
testing purposes.

* Made changes to dijkstras two stack algorithm for documentation and
testing purposes.

* Fixed Grammar Mistake

* Added Explanation Reference

* Imported stack instead of using my own
Changed a few minor things.

* Imported stack instead of using my own
Changed a few minor things.

* Update data_structures/stacks/dijkstras_two_stack_algorithm.py

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

* Update dijkstras_two_stack_algorithm.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-20 17:49:43 +02:00
Kushagra Bansal
456893cb5f
Created problem_43 in project_euler (#2340)
* Create __init__.py

* Add files via upload

* Update sol1.py

* Lose a list()

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-20 17:02:14 +02:00
Christian Clauss
8817a3e667
Delete natural_language_processing (#2317)
* Delete natural_language_processing

This file is useless.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-19 21:53:56 +02:00
Kushagra Bansal
2eca71663b
Created check_anagrams.py in strings (#2339)
* Add files via upload

* Update check_anagrams.py

* Update check_anagrams.py

* Update check_anagrams.py

* Update check_anagrams.py

* “” or not

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-19 18:24:02 +02:00
Kushagra Bansal
9351889fda
Created problem_41 in project_euler (#2334)
* Create __init__.py

* Add files via upload

* Update sol1.py

* Update sol1.py

* Update sol1.py
2020-08-19 12:55:06 +02:00
Kushagra Bansal
9a32f0b46c
Created problem_39 in project_euler (#2330)
* Create __init__.py

* Add files via upload

* Update sol1.py

* Update sol1.py

* Update project_euler/problem_39/sol1.py

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

* Update sol1.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-18 12:49:02 +02:00
Kushagra Bansal
051be078e4
Fix typo (#2325) 2020-08-17 17:43:46 +02:00
Kushagra Bansal
88341d1727
Created problem_37 in project_euler (#2323)
* Create __init__.py

* Add files via upload

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update project_euler/problem_37/sol1.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-17 16:39:58 +02:00