-
Notifications
You must be signed in to change notification settings - Fork 302
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
selection_sort.py: Add SelectionSort Algo #447
Conversation
Made changes including denoting completion of selection sort implementation in Python as well as standardization of Markdown
This comment has been minimized.
This comment has been minimized.
Comment on cc39a18, file selection_sort/python/selection_sort.py, line 8. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmp8sjn3jnu/selection_sort/python/selection_sort.py
+++ b/tmp/tmp8sjn3jnu/selection_sort/python/selection_sort.py
@@ -6,6 +6,7 @@
if Arr[j] < Arr[low]:
low = j
Arr[i], Arr[low] = Arr[low], Arr[i]
+
# Given array
Arr = [4, 3, 42, 82, 5, 2, 33] |
Comment on cc39a18, file selection_sort/python/selection_sort.py, line 4. E703 statement ends with a semicolon Origin: PycodestyleBear (E703), Section: |
Comment on cc39a18, file selection_sort/python/selection_sort.py, line 11. E305 expected 2 blank lines after class or function definition, found 1 Origin: PycodestyleBear (E305), Section: |
Comment on 93edc39, file selection_sort/python/selection_sort.py, line 4. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmpgvi3mzjv/selection_sort/python/selection_sort.py
+++ b/tmp/tmpgvi3mzjv/selection_sort/python/selection_sort.py
@@ -1,7 +1,7 @@
# Function to do selection sort of given array(Arr)
def selection_sort(Arr):
for i in range(len(Arr)):
- low = i;
+ low = i
for j in range(i+1, len(Arr)):
if Arr[j] < Arr[low]:
low = j |
Comment on 93edc39, file selection_sort/python/selection_sort.py, line 8. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmpgvi3mzjv/selection_sort/python/selection_sort.py
+++ b/tmp/tmpgvi3mzjv/selection_sort/python/selection_sort.py
@@ -6,6 +6,7 @@
if Arr[j] < Arr[low]:
low = j
Arr[i], Arr[low] = Arr[low], Arr[i]
+
# Given array
Arr = [4, 3, 42, 82, 5, 2, 33] |
Comment on 93edc39, file selection_sort/python/selection_sort.py, line 4. E703 statement ends with a semicolon Origin: PycodestyleBear (E703), Section: |
Comment on 93edc39, file selection_sort/python/selection_sort.py, line 11. E305 expected 2 blank lines after class or function definition, found 1 Origin: PycodestyleBear (E305), Section: |
Comment on f00d9de, file selection_sort/python/selection_sort.py, line 4. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmpghornuhk/selection_sort/python/selection_sort.py
+++ b/tmp/tmpghornuhk/selection_sort/python/selection_sort.py
@@ -1,7 +1,7 @@
# Function to do selection sort of given array(Arr)
def selection_sort(Arr):
for i in range(len(Arr)):
- low = i;
+ low = i
for j in range(i+1, len(Arr)):
if Arr[j] < Arr[low]:
low = j |
Comment on f00d9de, file selection_sort/python/selection_sort.py, line 8. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmpghornuhk/selection_sort/python/selection_sort.py
+++ b/tmp/tmpghornuhk/selection_sort/python/selection_sort.py
@@ -6,6 +6,7 @@
if Arr[j] < Arr[low]:
low = j
Arr[i], Arr[low] = Arr[low], Arr[i]
+
# Given array
Arr = [4, 3, 42, 82, 5, 2, 33] |
Comment on f00d9de, file selection_sort/python/selection_sort.py, line 4. E703 statement ends with a semicolon Origin: PycodestyleBear (E703), Section: |
Comment on f00d9de, file selection_sort/python/selection_sort.py, line 11. E305 expected 2 blank lines after class or function definition, found 1 Origin: PycodestyleBear (E305), Section: |
Comment on 1fbb1f5, file selection_sort/python/selection_sort.py, line 4. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmp3lch9w2z/selection_sort/python/selection_sort.py
+++ b/tmp/tmp3lch9w2z/selection_sort/python/selection_sort.py
@@ -1,7 +1,7 @@
# Function to do selection sort of given array(Arr)
def selection_sort(Arr):
for i in range(len(Arr)):
- low = i;
+ low = i
for j in range(i+1, len(Arr)):
if Arr[j] < Arr[low]:
low = j |
Comment on 1fbb1f5, file selection_sort/python/selection_sort.py, line 8. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmp3lch9w2z/selection_sort/python/selection_sort.py
+++ b/tmp/tmp3lch9w2z/selection_sort/python/selection_sort.py
@@ -6,6 +6,7 @@
if Arr[j] < Arr[low]:
low = j
Arr[i], Arr[low] = Arr[low], Arr[i]
+
# Given array
Arr = [4, 3, 42, 82, 5, 2, 33] |
Comment on 1fbb1f5, file selection_sort/python/selection_sort.py, line 4. E703 statement ends with a semicolon Origin: PycodestyleBear (E703), Section: |
Comment on 1fbb1f5, file selection_sort/python/selection_sort.py, line 11. E305 expected 2 blank lines after class or function definition, found 1 Origin: PycodestyleBear (E305), Section: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write good commit message which is given in the contributing guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please fix your commit message. Do take a look at commit guidelines.
- Do squash your commits (Try rebasing ;))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe all these changes are valid and agree to the application of the same to my code. I am still not an expert at GitHub and so I've made all changes as a separate branch for which I am ready to send a PR
Implementing best practices in writing markdown files I have complied with specification set by [markdownlint](https://github.com/DavidAnson/markdownlint/blob/v0.11.0/doc/Rules.md)
Comment on 98443df, file selection_sort/python/selection_sort.py, line 4. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmp52dhoqv4/selection_sort/python/selection_sort.py
+++ b/tmp/tmp52dhoqv4/selection_sort/python/selection_sort.py
@@ -1,7 +1,7 @@
# Function to do selection sort of given array(Arr)
def selection_sort(Arr):
for i in range(len(Arr)):
- low = i;
+ low = i
for j in range(i+1, len(Arr)):
if Arr[j] < Arr[low]:
low = j |
Comment on 98443df, file selection_sort/python/selection_sort.py, line 8. The code does not comply to PEP8. Origin: PEP8Bear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmp52dhoqv4/selection_sort/python/selection_sort.py
+++ b/tmp/tmp52dhoqv4/selection_sort/python/selection_sort.py
@@ -6,6 +6,7 @@
if Arr[j] < Arr[low]:
low = j
Arr[i], Arr[low] = Arr[low], Arr[i]
+
# Given array
Arr = [4, 3, 42, 82, 5, 2, 33] |
Comment on 98443df, file selection_sort/python/selection_sort.py, line 4. E703 statement ends with a semicolon Origin: PycodestyleBear (E703), Section: |
Comment on 98443df, file selection_sort/python/selection_sort.py, line 11. E305 expected 2 blank lines after class or function definition, found 1 Origin: PycodestyleBear (E305), Section: |
Compliance to PEP8 standards was maintained in the above correction to code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the Travis checks as your PR is breaking that. See the comments on your code above; you need to fix those.
| Python | ```python [filename.py]``` | | ||
| C | ```gcc [filename.c]```<br>```./a.out # unix```<br>```a.exe # windows```| | ||
| CPP | ```g++ [filename.cpp]```<br>```./a.out # unix```<br>```a.exe # windows```| | ||
| Java | ```javac [filename.java]```<br>```java [filename]``` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes needs to be ignored as it is being used as HTML tags and then being used for the website https://nitskmos.github.io/Algorithms/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -39,17 +37,15 @@ This repository contains examples of various algorithms written on different pro | |||
| [Binary Search Tree](https://en.wikipedia.org/wiki/Binary_search_tree) | | [:octocat:](binary_search_tree/Cpp) | | | | |||
| [Fenwick Tree](https://en.wikipedia.org/wiki/Fenwick_tree) | | | [:octocat:](fenwick_tree/java) | [:octocat:](fenwick_tree/Python) | | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant change
@@ -24,9 +23,8 @@ This repository contains examples of various algorithms written on different pro | |||
| [Shell Sort](https://en.wikipedia.org/wiki/Shellsort) | [:octocat:](shell_sort/C) | | | [:octocat:](shell_sort/Python) | | |||
| [Heap Sort](https://en.wikipedia.org/wiki/Heapsort) | | | | [:octocat:](heap_sort/python) | | |||
| [Maximum Subarray Problem](https://en.wikipedia.org/wiki/Maximum_subarray_problem) | | | | [:octocat:](/maximum_subarray/Python)| | |||
| [Knapsack Problem](https://en.wikipedia.org/wiki/Knapsack_problem) | | | | [:octocat:](knapsack_problem/Python)| | |||
| [Selecton Sort](https://en.wikipedia.org/wiki/Selection_sort) | [:octocat:](selection_sort/C) | | | | | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant change
| [Knapsack Problem](https://en.wikipedia.org/wiki/Knapsack_problem) | | | | [:octocat:](knapsack_problem/Python)| | ||
| [Selecton Sort](https://en.wikipedia.org/wiki/Selection_sort) | [:octocat:](selection_sort/C) | | | | | ||
|
||
| [Knapsack Problem](https://en.wikipedia.org/wiki/Knapsack_problem) | | | | [:octocat:](knapsack_problem/Python)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant change
@@ -6,7 +6,6 @@ | |||
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/NITSkmOS/Algorithms/blob/master/LICENSE) | |||
[![OpenHub](https://www.openhub.net/p/NITSkmOS-algo/widgets/project_thin_badge?format=gif)](https://www.openhub.net/p/NITSkmOS-algo?ref=Thin+badge) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant change
This adds SelectionSort Algorithm, which sorts
the element in O(n^2) time complexity. This PR
has the Python implementation of this algo.
Fixes #446
By submitting this pull request I confirm I've read and complied with the
below declarations.
{Tag}: Add {Algorithm/DS name} [{Language}]
, notUpdate README.md
orAdded new code
.