Skip to content

Updates #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5b483be
Added OOP approach to matrices (#1165)
jasper256 Sep 8, 2019
3c3f92d
Add problem 67 solution (#1170)
Hyftar Sep 8, 2019
030600f
Update matrix_class.py (#1175)
cclauss Sep 10, 2019
47d1795
Add Kth lexicographic permutation (#1179)
KirilBangachev Sep 13, 2019
f8e30cf
Digital Image Processing Tests (#1178)
mrvnmchm Sep 13, 2019
6fa3c0b
Add Flake8 F4 Tests to .travis.yml (#974)
PatOnTheBack Sep 13, 2019
768700b
Add delete to trie.py + tests (#1177)
ksangeet9ap Sep 13, 2019
a2b5a90
Added sequential minimum optimization algorithm for SVM (#508)
zqbake Sep 18, 2019
04962c0
Fix lgtm error display #1024 (#1190)
denis-trofimov Sep 21, 2019
837bfff
Rename sorted_vector_machines.py to support_vector_machines.py (#1195)
Holden-Lin Sep 22, 2019
01601e6
Add disjoint set (#1194)
luoheng23 Sep 23, 2019
e40d4a2
Added Matrix Exponentiation (#1203)
anirudnits Sep 25, 2019
6ac7b13
Min head with decrease key functionality (#1202)
Raj1998 Sep 25, 2019
2375bfb
Adding stooge sort (#1206)
Charitoc Sep 26, 2019
a79fc2b
Fix the build typo: fn --> fn1 (#1205)
cclauss Sep 26, 2019
4617aa7
DBSCAN algorithm (#1207)
cozek Sep 29, 2019
189b350
Deque (#1200)
Sep 30, 2019
b738281
maths-polynomial_evalutation (#1214)
msk4862 Oct 1, 2019
df44d1b
Update CONTRIBUTING.md (#1250)
cclauss Oct 2, 2019
b8490ed
Removed owners from README (#1254)
AnupKumarPanwar Oct 3, 2019
390feb0
Add doctests for sorting algorithms (#1263)
parth-paradkar Oct 3, 2019
0e333ae
added bogobogosort (#1258)
WilliamHYZhang Oct 3, 2019
0e2d6b2
adding softmax function (#1267)
cozek Oct 3, 2019
03aba96
added defination (#1244)
shubhamgarg2000 Oct 3, 2019
f970c73
Add problem 23 solution (#1261)
Hyftar Oct 3, 2019
d28fc71
Add problem18 solution (#1260)
Hyftar Oct 3, 2019
6e69208
Add problem 32 solution (#1257)
Hyftar Oct 3, 2019
309204a
Add problem 42 solution (#1259)
Hyftar Oct 3, 2019
07f04a2
adding jaccard similarity (#1270)
cozek Oct 4, 2019
9eac17a
psf/black code formatting (#1277)
WilliamHYZhang Oct 5, 2019
6ebd899
CONTRIBUTING.md: Fix mistake in doctest ;-) (#1266)
cclauss Oct 5, 2019
c4a9767
Update fibonacci_sequence_recursion.py (#1287)
NikhilCodes Oct 6, 2019
0a7d387
Added a python script for finding sum of arithmetic series (#1279)
TheRealDarkCoder Oct 6, 2019
b1a769c
Add pure implementation of K-Nearest Neighbours (#1278)
parth-paradkar Oct 6, 2019
9cc9f67
Chinese Remainder Theorem | Diophantine Equation | Modular Division (…
OddExtension5 Oct 6, 2019
067a9b5
adding input option and increasing the number of doctest (#1281)
mvhb Oct 6, 2019
01bc785
Fixed links in DIRECTORY.md (#1291)
AnupKumarPanwar Oct 7, 2019
22bd6ff
Update average_mean.py (#1293)
maramsumanth Oct 7, 2019
06d7361
Added comment (#1294)
nishant-ingle Oct 7, 2019
3a06aba
Update Linear Algebra Readme (#1298)
AgentEnder Oct 7, 2019
25701a9
added doctests to scoring_functions.py (#1300)
cozek Oct 8, 2019
0da4d0a
make code more readable (#1304)
realDuYuanChao Oct 8, 2019
f0568d6
less code (#1292)
realDuYuanChao Oct 8, 2019
e80d248
optimization (#1303)
realDuYuanChao Oct 8, 2019
61f7f94
Create karatsuba.py (#1309)
rishabh0098 Oct 8, 2019
b6cc37d
mergesort added (#1313)
jpg-130 Oct 9, 2019
ea47ae2
Adding missing Doctests (#1330)
jpg-130 Oct 9, 2019
e678879
Adding doctests for sum_of_subset.py (#1333)
jpg-130 Oct 11, 2019
67291a5
Modified longest_common_ssubsequence.py for successful doctests (#1332)
jpg-130 Oct 11, 2019
b190c8f
Rename GCD File (#1354)
AliabbasMerchant Oct 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ before_install: pip install --upgrade pip setuptools
install: pip install -r requirements.txt
before_script:
- black --check . || true
- flake8 . --count --select=E9,F401,F63,F7,F82 --show-source --statistics
- flake8 . --count --select=E9,F4,F63,F7,F82 --show-source --statistics
script:
- scripts/validate_filenames.py # no uppercase, no spaces, in a directory
- mypy --ignore-missing-imports .
Expand Down
88 changes: 51 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,38 @@ We are very happy that you consider implementing algorithms and data structure f

We appreciate any contribution, from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work.

Your contribution will be tested by our [automated testing on Travis CI](https://travis-ci.org/TheAlgorithms/Python/pull_requests) to save time and mental energy. After you have submitted your pull request, you should see the Travis tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button try to read through the Travis output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help.

#### Coding Style

We want your work to be readable by others; therefore, we encourage you to note the following:

- Please write in Python 3.x.
- Please consider running [__python/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not a requirement but it does make your code more readable. There are other code formatters (autopep8, yapf) but the __black__ style is now the recommendation of the Python core team. To use it,
- Please write in Python 3.7+. __print()__ is a function in Python 3 so __print "Hello"__ will _not_ work but __print("Hello")__ will.

- Please focus hard on naming of functions, classes, and variables. Help your reader by using __descriptive names__ that can help you to remove redundant comments.
- Single letter variable names are _old school_ so please avoid them unless their life only spans a few lines.
- Expand acronyms because __gcd()__ is hard to understand but __greatest_common_divisor()__ is not.
- Please follow the [Python Naming Conventions](https://pep8.org/#prescriptive-naming-conventions) so variable_names and function_names should be lower_case, CONSTANTS in UPPERCASE, ClassNames should be CamelCase, etc.

- We encourage the use of Python [f-strings](https://realpython.com/python-f-strings/#f-strings-a-new-and-improved-way-to-format-strings-in-python) where the make the code easier to read.

- Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ style is now the recommendation of the Python Core Team. To use it,
```bash
pip3 install black # only required the first time
black my-submission.py
black .
```

- All submissions will need to pass the test __flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics__ before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
```bash
pip3 install flake8 # only required the first time
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
```

- If you know [PEP 8](https://www.python.org/dev/peps/pep-0008/) already, you will have no problem in coding style, though we do not follow it strictly. Read the remaining section and have fun coding!

- Always use 4 spaces to indent.
- Original code submission require docstrings or comments to describe your work.

- Original code submission requires comments to describe your work.
- More on docstrings and comments:

- More on comments and docstrings:
If you are using a Uncyclopedia article or some other source material to create your algorithm, please add the URL in a docstring or comment to help your reader.

The following are considered to be bad and may be requested to be improved:

Expand All @@ -52,69 +64,72 @@ We want your work to be readable by others; therefore, we encourage you to note

This is too trivial. Comments are expected to be explanatory. For comments, you can write them above, on or below a line of code, as long as you are consistent within the same piece of code.

*Sometimes, docstrings are avoided.* This will happen if you are using some editors and not careful with indentation:
We encourage you to put docstrings inside your functions but please pay attention to indentation of docstrings. The following is acceptable in this case:

```python
def sumab(a, b):
"""
This function returns the sum of two integers a and b
Return: a + b
"""
This function sums a and b
"""
def sum(a, b):
return a + b
```

However, if you insist to use docstrings, we encourage you to put docstrings inside functions. Also, please pay attention to indentation to docstrings. The following is acceptable in this case:
- Write tests (especially [__doctests__](https://docs.python.org/3/library/doctest.html)) to illustrate and verify your work. We highly encourage the use of _doctests on all functions_.

```python
def sumab(a, b):
"""
This function sums two integers a and b
Return: a + b
This function returns the sum of two integers a and b
Return: a + b
>>> sumab(2, 2)
4
>>> sumab(-2, 3)
1
>>> sumab(4.9, 5.1)
10.0
"""
return a + b
```

- `lambda`, `map`, `filter`, `reduce` and complicated list comprehension are welcome and acceptable to demonstrate the power of Python, as long as they are simple enough to read.

- This is arguable: **write comments** and assign appropriate variable names, so that the code is easy to read!

- Write tests to illustrate your work.
These doctests will be run by pytest as part of our automated testing so please try to run your doctests locally and make sure that they are found and pass:
```bash
python3 -m doctest -v my_submission.py
```

The following "testing" approaches are **not** encouraged:
The use of the Python builtin __input()__ function is **not** encouraged:

```python
input('Enter your input:')
# Or even worse...
input = eval(input("Enter your input: "))
```

However, if your code uses __input()__ then we encourage you to gracefully deal with leading and trailing whitespace in user input by adding __.strip()__ to the end as in:
However, if your code uses __input()__ then we encourage you to gracefully deal with leading and trailing whitespace in user input by adding __.strip()__ as in:

```python
starting_value = int(input("Please enter a starting value: ").strip())
```

Please write down your test case, like the following:

```python
def sumab(a, b):
return a + b
# Write tests this way:
print(sumab(1, 2)) # 1+2 = 3
print(sumab(6, 4)) # 6+4 = 10
# Or this way:
print("1 + 2 = ", sumab(1, 2)) # 1+2 = 3
print("6 + 4 = ", sumab(6, 4)) # 6+4 = 10

The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](http://mypy-lang.org) so run that locally before making your submission.
```python
def sumab(a: int, b: int) --> int:
pass
```

Better yet, if you know how to write [__doctests__](https://docs.python.org/3/library/doctest.html), please consider adding them.
- [__list comprehensions and generators__](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) are preferred over the use of `lambda`, `map`, `filter`, `reduce` but the important thing is to demonstrate the power of Python in code that is easy to read and maintain.

- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.

- If you need a third party module that is not in the file __requirements.txt__, please add it to that file as part of your submission.

#### Other Standard While Submitting Your Work

- File extension for code should be `.py`. Jupiter notebook files are acceptable in machine learning algorithms.

- Strictly use snake case (underscore separated) in your file name, as it will be easy to parse in future using scripts.
- Please avoid creating new directories if at all possible. Try to fit your work into the existing directory structue.

- Strictly use snake_case (underscore_separated) in your file_name, as it will be easy to parse in future using scripts.

If possible, follow the standard *within* the folder you are submitting to.

Expand All @@ -135,5 +150,4 @@ We want your work to be readable by others; therefore, we encourage you to note
- Happy coding!



Writer [@poyea](https://github.com/poyea), Jun 2019.
Loading