From 33b5dc5de9652bfced44e85ff574e6a2ea47cfbf Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 13 Jan 2020 19:01:03 +0100 Subject: [PATCH 01/10] Create pull_request_template.md --- .github/pull_request_template.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000000..bb05180ad203 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,17 @@ +Describe your change: + + +* [ ] Add a algorithm? +* [ ] Fix a bug or typo in an existing algorithm? +* [ ] Documentation change? + +Checklist: +* [ ] I have read CONTRIBUTING.md. +* [ ] This pull request is all my own work -- I have not plagerized. +* [ ] I know that pull request will not be merged if they the automated tests. +* [ ] All new Python files are placed inside an existing directory. +* [ ] All files are in all lowercase characters with no spaces or dashes. +* [ ] All functions and variable names follow Python naming conventions. +* [ ] All function parameters and return values are annotated with Python type hints. +* [ ] All functions have doctests that pass the automated testing. +* [ ] All new algorithms have a URL that points to Wikipedia or other similar explaination. From 7f00d595724825d0bee395bf3a4a637684bdc987 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Mon, 13 Jan 2020 18:01:52 +0000 Subject: [PATCH 02/10] fixup! Format Python code with psf/black push --- sorts/recursive_insertion_sort.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sorts/recursive_insertion_sort.py b/sorts/recursive_insertion_sort.py index a8bd2b9114ad..39a903dd1bcb 100644 --- a/sorts/recursive_insertion_sort.py +++ b/sorts/recursive_insertion_sort.py @@ -4,6 +4,7 @@ from typing import List + def rec_insertion_sort(collection: List, n: int): """ Given a collection of numbers and its length, sorts the collections @@ -27,13 +28,13 @@ def rec_insertion_sort(collection: List, n: int): >>> print(col) [1] """ - #Checks if the entire collection has been sorted + # Checks if the entire collection has been sorted if len(collection) <= 1 or n <= 1: return + insert_next(collection, n - 1) + rec_insertion_sort(collection, n - 1) - insert_next(collection, n-1) - rec_insertion_sort(collection, n-1) def insert_next(collection: List, index: int): """ @@ -54,17 +55,19 @@ def insert_next(collection: List, index: int): >>> print(col) [] """ - #Checks order between adjacent elements + # Checks order between adjacent elements if index >= len(collection) or collection[index - 1] <= collection[index]: return - #Swaps adjacent elements since they are not in ascending order + # Swaps adjacent elements since they are not in ascending order collection[index - 1], collection[index] = ( - collection[index], collection[index - 1] + collection[index], + collection[index - 1], ) insert_next(collection, index + 1) + if __name__ == "__main__": numbers = input("Enter integers seperated by spaces: ") numbers = [int(num) for num in numbers.split()] From 8865c78a61a85fda2ade9e85e2f5099c2db0684a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 13 Jan 2020 19:04:54 +0100 Subject: [PATCH 03/10] Update pull_request_template.md --- .github/pull_request_template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bb05180ad203..61cda29004d8 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,11 +6,11 @@ Describe your change: * [ ] Documentation change? Checklist: -* [ ] I have read CONTRIBUTING.md. +* [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [ ] This pull request is all my own work -- I have not plagerized. * [ ] I know that pull request will not be merged if they the automated tests. * [ ] All new Python files are placed inside an existing directory. -* [ ] All files are in all lowercase characters with no spaces or dashes. +* [ ] All filenames are in all lowercase characters with no spaces or dashes. * [ ] All functions and variable names follow Python naming conventions. * [ ] All function parameters and return values are annotated with Python type hints. * [ ] All functions have doctests that pass the automated testing. From 7e7fb7d416d4c8a51c3c95d0b8d0f77cecaf41eb Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Mon, 13 Jan 2020 18:05:20 +0000 Subject: [PATCH 04/10] updating DIRECTORY.md --- DIRECTORY.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DIRECTORY.md b/DIRECTORY.md index 1116e8539536..75dea10d34dd 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -122,12 +122,12 @@ * [Linked Stack](https://github.com/TheAlgorithms/Python/blob/master/data_structures/stacks/linked_stack.py) * [Next Greater Element](https://github.com/TheAlgorithms/Python/blob/master/data_structures/stacks/next_greater_element.py) * [Postfix Evaluation](https://github.com/TheAlgorithms/Python/blob/master/data_structures/stacks/postfix_evaluation.py) + * [Prefix Evaluation](https://github.com/TheAlgorithms/Python/blob/master/data_structures/stacks/prefix_evaluation.py) * [Stack](https://github.com/TheAlgorithms/Python/blob/master/data_structures/stacks/stack.py) * [Stack Using Dll](https://github.com/TheAlgorithms/Python/blob/master/data_structures/stacks/stack_using_dll.py) * [Stock Span Problem](https://github.com/TheAlgorithms/Python/blob/master/data_structures/stacks/stock_span_problem.py) * Trie * [Trie](https://github.com/TheAlgorithms/Python/blob/master/data_structures/trie/trie.py) - * [Prefix Evaluation](https://github.com/TheAlgorithms/Python/blob/master/data_structures/prefix_evaluation.py) ## Digital Image Processing * [Change Contrast](https://github.com/TheAlgorithms/Python/blob/master/digital_image_processing/change_contrast.py) @@ -152,6 +152,8 @@ * [Inversions](https://github.com/TheAlgorithms/Python/blob/master/divide_and_conquer/inversions.py) * [Max Subarray Sum](https://github.com/TheAlgorithms/Python/blob/master/divide_and_conquer/max_subarray_sum.py) * [Mergesort](https://github.com/TheAlgorithms/Python/blob/master/divide_and_conquer/mergesort.py) + * [Power](https://github.com/TheAlgorithms/Python/blob/master/divide_and_conquer/power.py) + * [Strassen Matrix Multiplication](https://github.com/TheAlgorithms/Python/blob/master/divide_and_conquer/strassen_matrix_multiplication.py) ## Dynamic Programming * [Abbreviation](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/abbreviation.py) @@ -537,6 +539,7 @@ * [Random Pivot Quick Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/random_pivot_quick_sort.py) * [Recursive-Quick-Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/recursive-quick-sort.py) * [Recursive Bubble Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/recursive_bubble_sort.py) + * [Recursive Insertion Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/recursive_insertion_sort.py) * [Selection Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/selection_sort.py) * [Shell Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/shell_sort.py) * [Stooge Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/stooge_sort.py) From 510cac4c26ef5d3b59ccdbff105ea3b92a383527 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 13 Jan 2020 19:07:41 +0100 Subject: [PATCH 05/10] Update pull_request_template.md --- .github/pull_request_template.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 61cda29004d8..bb4b54fb6d95 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,10 +8,10 @@ Describe your change: Checklist: * [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [ ] This pull request is all my own work -- I have not plagerized. -* [ ] I know that pull request will not be merged if they the automated tests. +* [ ] I know that pull request will not be merged if they fail the automated tests. * [ ] All new Python files are placed inside an existing directory. * [ ] All filenames are in all lowercase characters with no spaces or dashes. * [ ] All functions and variable names follow Python naming conventions. -* [ ] All function parameters and return values are annotated with Python type hints. -* [ ] All functions have doctests that pass the automated testing. +* [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html). +* [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing. * [ ] All new algorithms have a URL that points to Wikipedia or other similar explaination. From 3d093d2b88e1665506cc9e6d6ded5cb05e51527f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 13 Jan 2020 19:08:35 +0100 Subject: [PATCH 06/10] Update pull_request_template.md --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bb4b54fb6d95..35471745204b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -14,4 +14,4 @@ Checklist: * [ ] All functions and variable names follow Python naming conventions. * [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html). * [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing. -* [ ] All new algorithms have a URL that points to Wikipedia or other similar explaination. +* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explaination. From 921d3548bde471acb062e87cdebb70bf1c005392 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 13 Jan 2020 19:09:02 +0100 Subject: [PATCH 07/10] Update pull_request_template.md --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 35471745204b..7c315b946731 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,7 @@ Describe your change: -* [ ] Add a algorithm? +* [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? From 124cd94ca39d6d1db313e7bc637b8f54a62b091f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 13 Jan 2020 19:09:51 +0100 Subject: [PATCH 08/10] Update pull_request_template.md --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7c315b946731..f40f642c76d1 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,7 +8,7 @@ Describe your change: Checklist: * [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [ ] This pull request is all my own work -- I have not plagerized. -* [ ] I know that pull request will not be merged if they fail the automated tests. +* [ ] I know that pull requests will not be merged if they fail the automated tests. * [ ] All new Python files are placed inside an existing directory. * [ ] All filenames are in all lowercase characters with no spaces or dashes. * [ ] All functions and variable names follow Python naming conventions. From d46a8d16157cf785c9ea3ac9a358dfd2b3ccbea7 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 13 Jan 2020 19:14:34 +0100 Subject: [PATCH 09/10] Update pull_request_template.md --- .github/pull_request_template.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f40f642c76d1..a538dbcbd0d4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,6 +9,7 @@ Checklist: * [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [ ] This pull request is all my own work -- I have not plagerized. * [ ] I know that pull requests will not be merged if they fail the automated tests. +* [ ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms. * [ ] All new Python files are placed inside an existing directory. * [ ] All filenames are in all lowercase characters with no spaces or dashes. * [ ] All functions and variable names follow Python naming conventions. From f6bf305150f75f766372f739eda3a307c9b55ff4 Mon Sep 17 00:00:00 2001 From: John Law Date: Tue, 14 Jan 2020 02:46:35 +0800 Subject: [PATCH 10/10] Typos and formatting --- .github/pull_request_template.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a538dbcbd0d4..2f130896ebe3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,13 +1,14 @@ -Describe your change: +### **Describe your change:** + * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? -Checklist: +### **Checklist:** * [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). -* [ ] This pull request is all my own work -- I have not plagerized. +* [ ] This pull request is all my own work -- I have not plagiarized. * [ ] I know that pull requests will not be merged if they fail the automated tests. * [ ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms. * [ ] All new Python files are placed inside an existing directory. @@ -15,4 +16,4 @@ Checklist: * [ ] All functions and variable names follow Python naming conventions. * [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html). * [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing. -* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explaination. +* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.