Commit Graph

146 Commits

Author SHA1 Message Date
Christian Clauss
2e90debab3
Tighten up quicksort() (#3319)
* Tighten up quicksort()

* updating DIRECTORY.md

* str does not support .pop()

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-15 15:07:34 +02:00
Christian Clauss
7c5cc28ba2
Revert recent changes to .pre-commit-config.yaml (#3318)
* Revert recent changes to .pre-commit-config.yaml

We must continue to insist that algorithmic functions can not print() as discussed in CONTRIBUTING.md.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-15 16:50:43 +05:30
Christian Clauss
aeb6edc792
.pre-commit-config.yaml: Disable trailing-whitespace fixer (#3306)
* .pre-commit-config.yaml: Disable trailing-whitespace fixer

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-15 11:11:22 +02:00
Peter Yao
671ab1d863
Project Euler 62 Solution (#3029)
* Add solution for Project Euler 62

* Add doctests and annotate function params and return values for get_digits()

* Add extra newline between functions to fix flake8 errors

* Add extra newlines between function names

* Add missing return type for solution()

* Remove parenthesis from if statement

* Remove parentheses from while loop

* Add to explanation and fix second Travis build

* Compress get_digits(), add tests for solution(), add fstring and positional arg for solution()

* Remove input param when calling solution()

* Remove test case for the answer
2020-10-15 09:13:39 +05:30
Christian Clauss
fda57d6924
codespell.yml: Remove unused install of flake8 (#3283)
* codespell.yml: Remove unused install of flake8

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-14 17:02:47 +05:30
Susmith98
dc069580b9
Added binary tree mirror algorithm (#3159)
* Added binary tree mirror algorithm

* Minor changes

* Resolved comments

* Minor Changes

* resolved comments and updated doctests

* updated doctests

* updating DIRECTORY.md

Co-authored-by: svedire <VedireSusmith_Reddy@intuit.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-14 12:21:15 +02:00
Dhruv
23ab159f30
Fix errors in Quantum algorithm (#3273)
* Fix pre-commit errors in Quantum algorithm

* updating DIRECTORY.md

* Fix doctest

* Update not_gate.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-14 07:58:52 +02:00
Dhruv
34d63d5155
Fix Travis CI slow build on Project Euler Solution job (#3262)
* Fix Travis CI long run for validate_solutions

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-13 22:43:40 +05:30
Abhishek Jaisingh
6e01004535
Add First Quantum Qiskit Code Tutorial (#3173)
* Add First Quantum Qiskit Code Tutorial

* Add Qiskit Requirement

* Address Review Comments

* fixup! Format Python code with psf/black push

* Update q1.py

* updating DIRECTORY.md

* Update and rename q1.py to single_qubit_measure.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-12 21:41:05 +02:00
Kushagra Bansal
08c26e667b
Update CODEOWNERS to add my preferences (#3233)
* Update CODEOWNERS

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-12 16:23:21 +02:00
Christian Clauss
f7e7ad2ef6
CONTRIBUTING.md Jupyter files belong in the Jupyter repo. (#3211)
* CONTRIBUTING.md Jupyter files belong in the Jupyter repo.

* updating DIRECTORY.md

* Update CONTRIBUTING.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-12 08:17:26 +08:00
Christian Clauss
731190842a
CODEOWNERS: Proper spelling of my userid (#3185)
* CODEOWNERS: Proper spelling of my userid

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-11 15:23:30 +05:30
Sandeep Gupta
c07b82fa63
Add Project Euler Problem 80 (#2885)
* adding solution to problem 80

* updating DIRECTORY.md

* fixing spell check

* updating sol as per comments

* Add reference link to the problem

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-10 17:06:25 +05:30
Tapajyoti Bose
02d3ab81bd
feat: added prim's algorithm v2 (#2742)
* feat: added prim's algorithm v2

* updating DIRECTORY.md

* chore: small tweaks

* fixup! Format Python code with psf/black push

* chore: added algorithm descriptor

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-10 12:18:52 +05:30
Tapajyoti Bose
8bd4ca67be
Added all sub sequence type hints [Hacktober Fest] (#3123)
* updating DIRECTORY.md

* chore(all-subsequence): added type hints [HACKTOBER-FEST]

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-10 11:49:36 +05:30
Meysam
c2a5033f9e
graphs/kruskal: add a test case to verify the correctness, fix styles (#2443)
* test/graphs/kruskal: adding a test case to verify the correctness of the algorithm

Fixes #2128

* grahps/kruskal: running psf/black

* graphs/kruskal: read edges in a friendlier fashion

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

* Update minimum_spanning_tree_kruskal.py

* fixup! Format Python code with psf/black push

* Update test_min_spanning_tree_kruskal.py

* updating DIRECTORY.md

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-08 20:21:48 +08:00
Dmytro Litvinov
000cedc07f
Add type hints for "strings" folder (#2882)
* Add type hints for strings/ folder

* Rerun other checks

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-06 14:01:15 +05:30
Iqrar Agalosi Nureyza
e040ad2a01
Add a solution for Project Euler 49 (#2702)
* added doctests in modular_exponential.py

* added doctests in modular_exponential.py

* added URL link

* updating DIRECTORY.md

* Add problem 49 solution

* updating DIRECTORY.md

* Fix several mistakes

These fixes are intended to follow the CONTRIBUTING.md

* Move the import statements lower

* Update project_euler/problem_49/sol1.py

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

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-05 08:27:09 +05:30
Richard Wheatley
3b0169549e
Create auto_close_empty_issues.yml (#2756)
* Create auto_close_empty_issues.yml

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-04 16:20:36 +02:00
Christian Clauss
ddfa9e4f22
Travis CI: Remove redundant tests (#2523)
* Travis CI: Remove redundant tests

* fixup! before_script

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-30 19:26:38 +02:00
Christian Clauss
db0db01d87
Use self-documenting option instead of cryptic option (#2487)
* Use self-documenting option instead of cryptic option

@mateuszz0000 Your review, please.  Pretend that you do not know what `-L` stands for.  How many keystrokes and clicks does it take to confirm the purpose of this option?

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-26 16:54:41 +02:00
Du Yuanchao
18f1dcd48a
Updated singly_linked_list (#2477)
* Updated singly_linked_list

* fixup! Format Python code with psf/black push

* undo __repr__

* updating DIRECTORY.md

* UNTESTED CHANGES: Add an .__iter__() method.

This will break tests, etc.

* fixup! Format Python code with psf/black push

* len(tuple(iter(self)))

* fixed __repr__()

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.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-09-25 16:09:29 +02:00
Du Yuanchao
a1ea76bcf3
Optimization problem_10 in project_euler (#2453)
* optimization for problem09 in project_euler

* added benchmark code

* fixup! Format Python code with psf/black push

* Update project_euler/problem_09/sol1.py

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

* updating DIRECTORY.md

* Update project_euler/problem_09/sol1.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-22 15:15:11 +02:00
Dhruv
ea0759dbaa
Create problem_54 in project Euler (#2451)
* Add solution and test files for project euler 54

* Update sol1.py

* updating DIRECTORY.md

* Fix: use proper path to open files

* Commit suggestions:

- Use list comprehension instead of map
- Sort imports using isort

* Changes made as suggested (simplified a lot):

- List and set comprehension instead of itemgetter
- Using enumerate as it's easy to read
- Divided into list of card values and set of card suit as set will
  remove all the duplicate values. So, no need for double indexing.
- Add test for testing multiple calls to five_high_straight function

* Add suggestions and simplified:

- Split generate_random_hands function into two:
  - First will generate a random hand
  - Second, which will be called, will return a generator object

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-20 13:52:13 +02:00
Christian Clauss
363858ef3b
hyphen_files = [file for file in filepaths if "-" in file] (#2447)
* hyphen_files = [file for file in filepaths if "-" in file]

* updating DIRECTORY.md

* Rename recursive-quick-sort.py to recursive_quick_sort.py

* updating DIRECTORY.md

* Rename aho-corasick.py to aho_corasick.py

* updating DIRECTORY.md

* Rename polynom-for-points.py to polynom_for_points.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 07:13:10 +02:00
Du Yuanchao
cbbc43ba3a
Updated problem_04 in project_euler (#2427)
* Updated problem_04 in project_euler

* fixup! Format Python code with psf/black push

* That number is larger than our acceptable range.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 22:33:08 +02:00
Du Yuanchao
44b8cb0c81
Updated Stack (#2414)
* * Added type hints
* Added test
* Formated code

* updating DIRECTORY.md

* Update stack.py

* Test error conditions for pop, peek, and

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 13:56:03 +02:00
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
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
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
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
23cbe4c352
black matrix_operation.py (#2199)
* black matrix_operation.py

* updating DIRECTORY.md

* Update matrix_operation.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: vinayak <itssvinayak@gmail.com>
2020-07-14 13:53:14 +05:30
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
Christian Clauss
2c98dce057
Rename shortest_job_first_algorithm.py to shortest_job_first.py (#2164)
* Rename shortest_job_first_algorithm.py to shortest_job_first.py

* updating DIRECTORY.md

* Minor tweek to round_robin.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-04 00:56:40 +05:30
vinayak
2d3d660155
black fixes and Travis CI fixes (#2160)
* black format

* updating DIRECTORY.md

* fixes

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-02 20:02:15 +05:30
Christian Clauss
8ab84fd794
Only one carriage return (#2155)
* updating DIRECTORY.md

* touch

* fixup! Format Python code with psf/black push

* Update word_frequency_functions.py

* updating DIRECTORY.md

* Update word_frequency_functions.py

* Update lfu_cache.py

* Update sol1.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-25 19:15:30 +02:00
Christian Clauss
5b6ebf8f12
Add doctests to radix_sort() (#2148)
* Add doctests to radix_sort()

* fixup! Format Python code with psf/black push

* Update radix_sort.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-23 15:37:24 +02:00
Nika Losaberidze
671e570c35
Implement prefix function, knuth-morris-pratt another usage (#2099)
* Implement prefix function, knuth-morris-pratt another usage

* fixup! Format Python code with psf/black push

* Fix style

* updating DIRECTORY.md

* Update prefix_function.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-17 18:27:05 +02:00
Nika Losaberidze
fb3a228d26
Strongly connected components (#2114)
* Implement strongly connected components for graph algorithms

* fixup! Format Python code with psf/black push

* Delete trailing whitespace

* updating DIRECTORY.md

* Add doctests and typehints

* Remove unnecessary comments, change variable names

* fixup! Format Python code with psf/black push

* Change undefined variable's name

* Apply suggestions from code review

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-06-17 18:16:54 +02:00
Nika Losaberidze
2bbdc3bfe7
Implement connected components algorithm for graphs (#2113)
* Implement connected components algorithm for graphs

* fixup! Format Python code with psf/black push

* Add parameters and return values annotations with Python type hints

* updating DIRECTORY.md

* Add doctests and typehints

* Remove unnecessary comments, change variable names

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-17 18:15:24 +02:00
mateuszz0000
d7a75da8ef
Added doctests to bucket sort (#2079)
* Added doctests to bucket sort

* Missing typehint

* Wrap long lines

* updating DIRECTORY.md

* Update bucket_sort.py

* updating DIRECTORY.md

* Update bucket_sort.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-17 09:42:44 +02:00
Christian Clauss
f97af65579
Blacken our code (#2125)
* Blacken

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-17 06:59:38 +08:00
Christian Clauss
4e8a0d924e
CONTRIBUTING.md: Update flake8 command (#2124)
* CONTRIBUTING.md: Update flake8 command

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 16:33:17 +02:00
Christian Clauss
b9e5259aeb
Fix long line, tests (#2123)
* Fix long line

* updating DIRECTORY.md

* Add doctest

* ...

* ...

* Update tabu_search.py

* space

* Fix doctest

    >>> find_neighborhood(['a','c','b','d','e','a'])  # doctest: +NORMALIZE_WHITESPACE
    [['a','e','b','d','c','a',90], [['a','c','d','b','e','a',90],
     ['a','d','b','c','e','a',93], ['a','c','b','e','d','a',102],
     ['a','c','e','d','b','a',113], ['a','b','c','d','e','a',93]]

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-06-16 14:29:13 +02:00
Christian Clauss
b9185bebd6
Create natural_language_processing (#2116)
* Create natural_language_processing

Closes #2115

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-15 09:55:41 +02:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
mateuszz0000
3de6f010c3
Refactor remove duplicates to more pythonic (#2093)
* Refactor strings/remove_duplicate to more pythonic

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-11 06:13:40 +02:00
mateuszz0000
1e7df7f77a
Errors notifications under pull requests (#2081)
* Added error comments under pull requests

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-08 14:11:01 +02:00
Christian Clauss
1e8fe8efcf
circular_linked_list: Add more len() tests (#2051)
* circular_linked_list: Add more len() tests

* fixup! Format Python code with psf/black push

* prepend()

* updating DIRECTORY.md

* Fix decrementation of self.length

* Add empty list tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-31 13:06:57 +05:30
Christian Clauss
fa358d614a
current_weather, weather_forecast, weather_onecall (#2048)
* current_weather, weather_forecast, weather_onecall

* updating DIRECTORY.md

* weather_forecast("Kolkata, India")

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-30 23:47:26 +05:30
Nitisha Bharathi
0e619065e7
added Boruvka's MST algorithm (#2026)
* added Boruvka's MST algorithm

* Add files via upload

* fixup! Format Python code with psf/black push

* Updated Boruvka with doctest

* updating DIRECTORY.md

* Update minimum_spanning_tree_boruvka.py

* No blank line in doctest

* <BLANKLINE>

* Avoid mutable default values

https://docs.python-guide.org/writing/gotchas/

* Update minimum_spanning_tree_boruvka.py

* Avoid mutable default values

* fixup! Format Python code with psf/black push

* Update minimum_spanning_tree_boruvka.py

* Update minimum_spanning_tree_boruvka.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-25 15:10:54 +02:00
Christian Clauss
dc4049ee28
.travis.yml: Revert to using autoblack (#2033)
* .travis.yml: Revert to using autoblack

Our autoblack GitHub Action will get us to black compliance without forcing each contributor to learn about, install, and use psf/black on every pull request.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-24 20:38:28 +05:30
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Christian Clauss
0e6e5056b3
singly_linked_list.py: psf/black (#2008)
* singly_linked_list.py: psf/black

* updating DIRECTORY.md

* Update singly_linked_list.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-19 13:54:25 +02:00
Kenneth P
77f3888b71
Pi digit extraction algorithm (#1996)
* added pi digit extraction formula

* updating DIRECTORY.md

* fixed typo in a comment

* updated bbp_formula.py

* Update maths/bbp_formula.py

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

* Update maths/bbp_formula.py

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

* Update bbp_formula.py

* Update and rename bbp_formula.py to bailey_borwein_plouffe.py

* updating DIRECTORY.md

* calculate

* "".join(bailey_borwein_plouffe(i) for i in range(1, 12))

* Update bailey_borwein_plouffe.py

* Update bailey_borwein_plouffe.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-18 22:54:08 +02:00
Christian Clauss
38d2e98665
hill_cipher.py: gcd() -> greatest_common_divisor() (#1997)
* hill_cipher.py: gcd() -> greatest_common_divisor()

* fixup! Format Python code with psf/black push

* import string

* updating DIRECTORY.md

* Change matrix to array

Add more tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-05-18 13:05:51 +02:00
Christian Clauss
565060aa99
actions/setup-python@v2 (#1986)
* actions/setup-python@v2

* fixup! Format Python code with psf/black push

* Update autoblack.yml

* updating DIRECTORY.md

* Update codespell.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-16 08:49:56 +02:00
Christian Clauss
69171a9ac3
The new version of flake8 is linting f-strings (#1976)
* The new version of flake8 is linting f-strings

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-13 20:03:28 +02:00
Christian Clauss
a7cd633bb6
Fix astar (#1966)
* Fix astar

Single character variable names are old school.

* fixup! Format Python code with psf/black push

* Tuple

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-10 20:49:40 +05:30
Christian Clauss
8b55a143fa
Travis CI: lint for useless backslashes (#1961)
* Travis CI: lint for useless backslashes

* updating DIRECTORY.md

* flake8  --max-complexity=25

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-09 13:24:25 +02:00
Christian Clauss
08c8bb5ad5
Deal with maps (#1945)
* Deal with maps

Try with the search term "pizza" to see why this was done in #1932

* fixup! Format Python code with psf/black push

* Update armstrong_numbers.py

* updating DIRECTORY.md

* Update crawl_google_results.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-06 03:32:40 +02:00
Sanders Lin
1e84aabaea
Create sol2.py (#1876)
* Create sol2.py

* updating DIRECTORY.md

* Update DIRECTORY.md

* updating DIRECTORY.md

* Update sol2.py

* Update DIRECTORY.md

* updating DIRECTORY.md

* Improve docstrings

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: vinayak <itssvinayak@gmail.com>
Co-authored-by: John Law <johnlaw@linux.com>
2020-05-05 17:27:18 +02:00
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
Sanders Lin
308505f18f
Add shortest path by BFS (#1870)
* Create breadth_first_search_shortest_path.py

* updating DIRECTORY.md

* Reduce side effect of `shortest_path`

For the sake of future testing and documentation -

* fixup! Format Python code with psf/black push

* Fix typo `separately`

* Change to get() from dictionary

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Move graph to the top

* fixup! Format Python code with psf/black push

* Add doctest for shortest path

* Add doctest for BFS

* fixup! Format Python code with psf/black push

* Add typings for breadth_first_search_shortest_path

* fixup! Format Python code with psf/black push

* Remove assert from doctests

* Add blank line to doctest

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: John Law <johnlaw@linux.com>
2020-05-01 07:24:32 +02:00
Christian Clauss
8cb957f893
Blacken one_dimensional.py (#1911)
* Blacken one_dimensional.py

* updating DIRECTORY.md

* Travis CI: Upgrade to Ubuntu 20.04 LTS Focal

Ubuntu 20.04 LTS (Focal Fossa) https://releases.ubuntu.com/focal

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-27 18:40:46 +02:00
Christian Clauss
24b2aecef3
Create Python/bit_manipulation/README.md (#1897)
* Create Python/bit_manipulation/README.md

To open up a new area of algorithms...

@Shrutikabansal I hope that you will contribute some of your work here.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-20 20:19:27 +02:00
Sanders Lin
7aaf79cc23
Initialize set with source in DFS (#1872)
* Update dfs.py

* Add type hints, rearrange doc-strings and comments

* fixup! Format Python code with psf/black push

* dfs -> depth_first_search

Co-Authored-By: Christian Clauss <cclauss@me.com>

* dfs -> depth_first_search

* Add doctest for DFS

* fixup! Format Python code with psf/black push

* Rename dfs.py to depth_first_search_dictionary.py

* updating DIRECTORY.md

* Rename depth_first_search_dictionary.py to depth_first_search_dfs.py

* updating DIRECTORY.md

* Rename depth_first_search.py to depth_first_search_2.py

* updating DIRECTORY.md

* Rename depth_first_search_dfs.py to depth_first_search.py

* updating DIRECTORY.md

Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-17 20:05:29 +02:00
Christian Clauss
d48661e35d
CONTRIBUTING.md: What is an Algorithm? (#1885)
* CONTRIBUTING.md: What is an Algorithm?

We are seeing too many _how-to examples_ for using existing Python packages so we should define what we want algorithm contributions to be.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-17 12:42:00 +02:00
Christian Clauss
f6ee518ee1
Rename math/add.py to maths/add.py (#1857)
* Rename math/add.py to maths/add.py

* fixup! Format Python code with psf/black push

* Fix sum to add

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-04-13 07:50:46 +02:00
Joan Martin Miralles
a38e143cf8
Binary search tree using recursion (#1839)
* Binary search tree using recursion

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-07 18:09:05 +02:00
Christian Clauss
ab3400bfad
Travis CI: Fix Travis linter errors (#1802)
* Travis CI: Fix Travis linter errors

* fixup! Format Python code with psf/black push

* Update .travis.yml

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-14 23:55:13 +01:00
John Law
2da98db4a7
Effective directory writer (#1800)
* updating DIRECTORY.md

* Update directory_writer.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-14 06:37:44 +01:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +01:00
Christian Clauss
652b891a75
Travis CI: Upgrade to Python 3.8 (#1783)
* Travis CI: Upgrade to Python 3.8

* updating DIRECTORY.md

* Tensorflow is not yet compatible with Python 3.8

* Disable k_means_clustering_tensorflow.py

* updating DIRECTORY.md

* Disable gan.py

* updating DIRECTORY.md

* Disable input_data.py

* updating DIRECTORY.md

* pip install a current version of six
2020-02-23 04:23:00 +01:00
Christian Clauss
bef74d0ecc Fix typo (#1718)
* Fix typo

* updating DIRECTORY.md
2020-01-28 05:09:47 +08:00
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Christian Clauss
b492e64417 Create pull_request_template.md (#1684)
* Create pull_request_template.md

* fixup! Format Python code with psf/black push

* Update pull_request_template.md

* updating DIRECTORY.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Typos and formatting

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-01-14 02:56:06 +08:00
Leon Morten Richter
4607cd48b6 Add a program to evaluate a string in prefix notation (Polish Notation) (#1675)
* Create infix_evaluation.py

* fix doctests

* Rename infix_evaluation.py to prefix_evaluation.py

* Add prefix_evaluation.py to directory
2020-01-12 15:00:40 +05:30
Christian Clauss
f9e1a16a98 git add DIRECTORY.md (#1674)
* git add DIRECTORY.md

* updating DIRECTORY.md
2020-01-10 09:08:49 +08:00
Jasper
3242682473 Create roman_to_integer.py (#1636)
* added roman to integer conversion (LeetCode No. 13)

* updated directory to include Roman to Integer

* Delete DIRECTORY.md

* Update roman_to_integer.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-21 00:23:15 +01:00
Níkolas Vargas
938dd0bbb5 improved prime numbers implementation (#1606)
* improved prime numbers implementation

* fixup! Format Python code with psf/black push

* fix type hint

* fixup! Format Python code with psf/black push

* fix doctests

* updating DIRECTORY.md

* added prime tests with negative numbers

* using for instead filter

* updating DIRECTORY.md

* Remove unused typing.List

* Remove tab indentation

* print("Sorted order is:", " ".join(a))
2019-12-07 06:39:08 +01:00
Bruno Santos
415c9f5e65 Improve prim.py (#1226)
* suiting PEP8

* create auxiliary function

* running example

* updating DIRECTORY.md
2019-12-01 06:13:28 +01:00
ELNS
140b79b4b2 Adding Linear Discriminant Analysis (#1592)
* Adding new file to the machine_learning directory

* Adding initial documentation

* importing modules

* Adding Normal_gen function

* Adding Y_gen function

* Adding mean_calc function

* Adding prob_calc function

* Adding var_calc function

* Adding predict function

* Adding accuracy function

* Adding main function

* Renaming LDA file

* Adding requested changes

* Renaming some of functions

* Refactoring str.format() statements to f-string

* Removing unnecessary list objects inside two functions

* changing code style in some lines

* Fixing y_generator function

* Refactoring 'predict_y_values' function by using list comprehensions

* Changing code style in import statements

* Refactoring CLI code block

* fixup! Format Python code with psf/black push

* No lines longer than 88 characters
2019-11-26 12:57:53 +01:00
Mantas Zimnickas
5616fa9e62 Add pytest-cov (#1578)
* Add pytest-cov

Also added coverage report in .travis.yml file.

* updating DIRECTORY.md

* Sort by missing statements

* sort = Cover
2019-11-17 19:37:58 +01:00
Ankur Chattopadhyay
a7424cc115 changed implementation of GitHub action to auto update DIRECTORY.md (#1571)
* changed implementation of GitHub action to auto update DIRECTORY.md

* updating DIRECTORY.md
2019-11-14 21:30:35 +01:00
Sarath Kaul
e3f55aecce Remove Duplicate Script Added (#1570)
* Added Remove duplicate script and updated requirements.txt

* Requirements.txt Updated

* Remove Duplicate Script Added

* Directory Modified

* Directory.md Updated
2019-11-14 21:01:51 +01:00
Marvin M. Michum
ea9bf0a90c directory_writer (#1) (#1549)
* directory_writer

* fixup: Format Python code with psf/black

* fixup: DIRECTORY.md
2019-11-14 20:27:31 +01:00
Ankur Chattopadhyay
a61b05b10c minor changes in format of DIRECTORY.md (#1461) 2019-10-25 19:33:24 +02:00
Anup Kumar Panwar
01bc785e84 Fixed links in DIRECTORY.md (#1291) 2019-10-07 23:23:46 +05:00
Jai Kumar Dewani
ab25079e16 Update DIRECTORY (#1161)
* Update DIRECTORY

* Updated DIRECTORY

* Fixed bug in directory build and re-build the directory.md

* fixed url issue

* fixed indentation in Directory.md
2019-09-06 11:02:37 +02:00
Christian Clauss
27205d4548
Update DIRECTORY.md (#1129) 2019-08-14 23:24:58 +02:00
Christian Clauss
a0817bdcf0
Rewrite build_directory_md.py (#1076)
* Rewrite build_directory_md.py

* Regenerate DIRECTORY.md
2019-07-28 17:27:23 +02:00
Christian Clauss
f5e6d4e8cd Update DIRECTORY.md (#1046)
* Update DIRECTORY.md

* Remove blank lines
2019-07-20 13:06:55 +05:30
Hector S
d72586c5f4 Updated ~script.py per #978 (#1013)
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory

* Removed .vs/ folder per #893

* Rename matrix_multiplication_addition.py to matrix_operation.py

* Moved and renamed ~script.py to scripts/build_directory_md.py
Updated DIRECTORY.MD file

* Modified .travis.yml per suggestion in #1013

* Fixed typo per suggestions in #1013
2019-07-13 21:50:37 +02:00
Hector S
05fc7f8a33 Added '~script.py' to ignore files and updated DIRECTORY.md (#926)
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory

* Removed .vs/ folder per #893

* Rename matrix_multiplication_addition.py to matrix_operation.py

* Added '~script.py' to ignore files and updated DIRECTORY.md
2019-07-04 23:18:57 +08:00
Daniel Xu
ef147484ab Added script for automatically generating DIRECTORY.md (#889)
* Added script for automatically generating DIRECTORY.md

* Sort and list files by alphabetical order

* Rename script.py to ~script.py
2019-06-17 18:17:53 +08:00