Commit Graph

1682 Commits

Author SHA1 Message Date
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
Du Yuanchao
34294b5641
Update sum_of_digits.py (#2319)
* * support negative number
* add different version

* fixup! Format Python code with psf/black push

* sum(int(c) for c in str(abs(n)))

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-16 20:31:06 +02:00
Kushagra Bansal
7e4176ccaf
Created problem_35 in project_euler (#2309)
* Create __init__.py

* Update __init__.py

* Add files via upload

* Update sol1.py

* Update sol1.py to include type hints

* Update CONTRIBUTING.md to fix typo

* Update CONTRIBUTING.md

* Update project_euler/problem_35/sol1.py

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

* Update project_euler/problem_35/sol1.py

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

* Update project_euler/problem_35/sol1.py

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

* Update project_euler/problem_35/sol1.py

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

* Update project_euler/problem_35/sol1.py

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

* Update project_euler/problem_35/sol1.py

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

* Update project_euler/problem_35/sol1.py

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Fix the print(f"string")

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-16 07:52:48 +02:00
Yukti Khosla
14199e0590
Create Transformations2D.py (#2310)
* Create Transformations2D.py

* Update Transformations2D.py

* Drop numpy and add type hints and doctests

* Rename Transformations2D.py to transformations_2d.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-15 18:19:33 +02:00
Guillaume Rochedix
fcc8a28c31
Gnome sort : type hints, docstrings, doctests (#2307)
* gnome_sort : type hints, docstring, doctests

* !Gadeimnoprstu

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-14 22:00:08 +02:00
Kushagra Bansal
b3ae39249d
Created problem_34 in project_euler (#2305)
* Create __init__.py

* Add files via upload

* Rename solution.py.py to solution.py

* Delete __init__.py

* Update and rename solution.py to sol1.py

* Update sol1.py

* Create __init__.py

* Update __init__.py

* Delete __init__.py

* Add files via upload

* Update __init__.py

* Add #\n

* Update sol1.py

Incorporates the proposed changes

* 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 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 sol1.py

* Update sol1.py

* Use int(n) instead of floor(n)

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-13 16:52:47 +02:00
Du Yuanchao
d687030d9e
fix number_of_digits bug (#2301)
* fix bug

* test larger negative

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-12 18:32:35 +02:00
Tapajyoti Bose
aa46639cbc
Added Kruskal's Algorithm (more organized than the one present) (#2218)
* Added Kruskal's Algorithm

* Added Type Hints

* fixup! Format Python code with psf/black push

* Added Type Hints V2

* Implemented suggestions + uniform naming convention

* removed redundant variable (self.nodes)

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-12 12:16:17 +02:00
kanthuc
d25a926c02
adding static type checking to basic_binary_tree.py (#2293)
* 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()

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-11 23:38:38 +02:00
Christian Clauss
e49ece95a4
PIL.Image.point() takes an int, not a float (#2284)
* PIL.Image.point() takes an int, not a float

@furkanatesli Trying to remove these warnings from our Travis CI build logs...
https://travis-ci.com/github/TheAlgorithms/Python/builds/178602503#L809

* fixup! Format Python code with psf/black push

* Revert changes to change_brightness.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-07 21:20:56 +02:00
Christian Clauss
1fb1fdd130
requirements.txt: Unpin numpy (#2287)
* requirements.txt: Unpin numpy

* fixup! Format Python code with psf/black push

* Less clutter

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-06 17:50:23 +02:00
Sanders Lin
f0d7879a11
fixed error in factorial.py (#1888)
* Update factorial.py

* updating DIRECTORY.md

* Update dynamic_programming/factorial.py

* Update factorial.py

Co-authored-by: mateuszz0000 <mtszzwdzk@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-05 13:18:41 +02:00
Filip Hlasek
871f8f4e00
More efficient least common multiple. (#2281)
* More efficient least common multiple.

* lowest -> least

* integer division

* Update least_common_multiple.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-05 12:39:15 +02:00
Mark
a891f6802a
Procentual proximity scoring algorithm implemented (#2280)
* Procentual proximity scoring algorithm implemented

- added requested changes
- passed doctest

- passed flake8 test

* Apply suggestions from code review

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

* Function rename

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-04 22:11:07 +02:00
Rayvant Sahni
8e7aded87f
World covid19 stats (#2271)
* Josephus problem in Python

Added the code for the josephus problem in python using circular linked lists.

* Update josephus_problem.py

* Added World covid19 stats in web programming

* Delete josephus_problem.py

* Type hints, algorithmic functions should not print

Return a dict of world covid19 stats.  Move all printing into the main functions.

* Update world_covid19_stats.py

* Update world_covid19_stats.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-03 08:45:53 +02:00
TheSuperNoob
b2e8672f02
Fix doubly linked list algorithm (#2062)
* Fix doubly linked list algorithm

* Fix bug with insert_at_tail method

Create __str__() method for Node class and LinkedList class

* Simplify __str__() of LinkedList

Returns empty string if there are no elements in the list

* Fix description
2020-08-02 23:55:18 +08:00
poloso
b875f66f00
Deleted optimization empty directory (#2262) 2020-08-02 06:38:00 +02:00
Sven
1495382367
Fixed bug with incorrect LU decomposition (#2261)
* Fixed Bug #2257

* =

Co-authored-by: Svn-Sp <svn-sp@email>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-01 22:11:39 +02:00
spamegg
473072bd4f
added type hints and doctests to arithmetic_analysis/newton_method.py (#2259)
* added type hints and doctests to arithmetic_analysis/newton_method.py

Continuing #2128
Also changed some variable names, made them more descriptive.

* Added type hints and doctests to arithmetic_analysis/newton_method.py

added a type alias for Callable[[float], float] and cleaned up the exception handling

* added type hints and doctests to arithmetic_analysis/newton_method.py

improved exception handling

* Update newton_method.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-01 15:17:46 +02:00
spamegg
9cda130c07
added type hints and doctests to arithmetic_analysis/intersection.py (#2242)
continuing #2128
2020-08-01 08:02:31 +02:00
Prashant Anand
b57b6abb48
fix doctests for recursive binary search (#2229) 2020-08-01 07:26:04 +02:00
Arin Khare
c6c9f4707b
Karger's Algorithm (#2237)
* Add implementation of Karger's Algorithm

* Remove print statement from karger's algorithm function

* Fix style issues in graphs/karger.py

* Change for loops to set comprehensions where appropriate in graphs/karger.py
2020-08-01 09:30:34 +05:30
Christian Clauss
4535283554
Re-blacken (#2246)
* Avoid double spaces

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-01 09:23:23 +05:30
Sumuk Shashidhar
e2ee52d773
removed redundant data_structures folder (#2256) 2020-07-31 20:36:02 +02:00
aryan26roy
373f193c6d
Correcting the Gaussian Formula (#2249)
* Correcting the Gaussian Formula

I have added the parenthesis around the 2*sigma^2 term.

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 21:32:36 +02:00
Utsav Akash Naskar
c7a5f1673e
Python Program to Check Krishnamurthy Number (#2248)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

* Added Python Program to Check Krishnamurthy Number or not

* Added Python Program to Check Krishnamurthy Number

* Added Python Program to Check Krishnamurthy Number or not

* Build Error Fix - 1

* Build Error Fix - 2

* Fix Brackets positions

* Fix Character Exceeding Error

* Made Review Changes

* Build Error Fix - 3

* Build Error Fix - 4

* Update krishnamurthy_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 10:54:05 +02:00
lance-pyles
f760ecc73c
initial commit of prefix-conversions (#2243)
* initial commit of prefix-conversions

* minor tweaks;

* Lose the blank lines

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 00:11:16 +02:00
Utsav Akash Naskar
9ea144f3bd
Added Python Program to Check Perfect Number (#2244)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-28 09:59:44 +02:00
Palash Sharma
ee282d3687
Update min_heap.py (#2245)
Changed min head to min heap in the first line.
2020-07-28 07:55:35 +02:00
lance-pyles
093a56e3c2
Remove function overhead in area (#2233)
* remove function overhead
add type hints

* remove unused import
2020-07-27 21:29:31 +08:00
spamegg
bd74f20bf2
added type hints and doctests to arithmetic_analysis/bisection.py (#2241)
* added type hints and doctests to arithmetic_analysis/bisection.py

continuing in line with #2128

* modified arithmetic_analysis/bisection.py

Put back print statement at the end, replaced algorithm's print statement with an exception.

* modified arithmetic_analysis/bisection.py

Removed unnecessary type import "Optional"

* modified arithmetic_analysis/bisection.py

Replaced generic Exception with ValueError.

* modified arithmetic_analysis/bisection.py

fixed doctests
2020-07-27 15:23:55 +02:00
Utsav Akash Naskar
dfb4ce4074
Added Finding Exponent Program (#2238)
* Finding Exponent Program

* Build Error Fix - 1

* Build Error Fix - 2

* Error Fix - 1 datatype

* self-documenting naming convension added

* Update and rename exponent_recursion.py to power_using_recursion.py

* Fix typo

* Fix typo

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-27 11:33:13 +02:00
Vasu Gamdha
e296f7b3ff
Updated maths/number_of_digits.py (#2221)
* Updated number_of_digits.py

Added two more methods!

* Update number_of_digits.py

* Update number_of_digits.py

* Added benchmarks!

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py
2020-07-26 12:42:18 +02:00
zakademic
977dfaa46c
Linear algebra/power iteration (#2190)
* Initial commit of power iteration.

* Added more documentation for power iteration and rayleigh quotient

* Type hinting for rayleigh quotient

* Changes after running black and flake8.

* Added doctests, added unit tests. Removed Rayleigh quotient as it is not needed.

* Update linear_algebra/src/power_iteration.py

Changed convergence check line.

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

* Update linear_algebra/src/power_iteration.py

Named tests more clearly.

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

* Changed naming in test function to be more clear. Changed naming in doctests to match function call.

* Self running tests

Co-authored-by: Zeyad Zaky <zeyadzaky@Zeyads-MacBook-Pro.local>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-26 10:51:10 +02:00
lance-pyles
44f9fd12c2
added tests (#2234) 2020-07-25 20:58:53 +02:00
lance-pyles
99b40e2a26
add Rankine scale (#2232)
* add Rankine scale
black formatting

* add Wikipedia links

* add optional rounding, default to 2 digits

* fix variable name

* fixed variable name; helps to stage before commiting
2020-07-24 22:55:18 +02:00
RobotGuy999
a823a86a29
Added "Inverse of Matrix" Algorithm (#2209)
* Added "Inverse of Matrix" Algorithm

* Small quotation marks change

* Update inverse_of_matrix.py

* Updated doctests

* Update inverse_of_matrix.py

* Add type hints

* swaped --> swapped

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-23 13:18:17 +02:00