-
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
Implemented the selection sort algo using python and java #473
Conversation
@@ -0,0 +1,28 @@ | |||
''' | |||
____ _ _ _ ____ _ |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -1,5 +1,5 @@
'''
- ____ _ _ _ ____ _
+ ____ _ _ _ ____ _
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __|
___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
@@ -0,0 +1,28 @@ | |||
''' | |||
____ _ _ _ ____ _ | |||
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_ |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -1,6 +1,6 @@
'''
____ _ _ _ ____ _
-/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
+/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __|
___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
|____/ \___|_|\___|\___|\__|_|\___/|_| |_|____/ \___/|_| \__|
____ _ _ _ ____ _ | ||
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_ | ||
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __| | ||
___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_ |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -2,7 +2,7 @@
____ _ _ _ ____ _
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __|
- ___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
+ ___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
|____/ \___|_|\___|\___|\__|_|\___/|_| |_|____/ \___/|_| \__|
'''
def sort(a): | ||
max_idx = len(a) - 1 | ||
for idx in range(0, max_idx): | ||
min_idx = idx |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -14,7 +14,7 @@
def sort(a):
max_idx = len(a) - 1
for idx in range(0, max_idx):
- min_idx = idx
+ min_idx = idx
for i in range(idx+1, max_idx+1):
if a[i] < a[min_idx]:
min_idx = i
for i in range(idx+1, max_idx+1): | ||
if a[i] < a[min_idx]: | ||
min_idx = i | ||
a[idx], a[min_idx] = a[min_idx], a[idx] |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -18,7 +18,7 @@
for i in range(idx+1, max_idx+1):
if a[i] < a[min_idx]:
min_idx = i
- a[idx], a[min_idx] = a[min_idx], a[idx]
+ a[idx], a[min_idx] = a[min_idx], a[idx]
return a
min_idx = i | ||
a[idx], a[min_idx] = a[min_idx], a[idx] | ||
return a | ||
|
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -20,7 +20,7 @@
min_idx = i
a[idx], a[min_idx] = a[min_idx], a[idx]
return a
-
+
if __name__ == "__main__":
rand_list = random.sample(range(1000), 40)
import java.util.Random; | ||
|
||
/* | ||
____ _ _ _ ____ _ |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Java/SelectionSort.java
+++ b/tmp/tmpz6y7xvz3/selection_sort/Java/SelectionSort.java
@@ -1,7 +1,7 @@
import java.util.Random;
/*
- ____ _ _ _ ____ _
+ ____ _ _ _ ____ _
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __|
___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
|
||
/* | ||
____ _ _ _ ____ _ | ||
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_ |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Java/SelectionSort.java
+++ b/tmp/tmpz6y7xvz3/selection_sort/Java/SelectionSort.java
@@ -2,7 +2,7 @@
/*
____ _ _ _ ____ _
-/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
+/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __|
___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
|____/ \___|_|\___|\___|\__|_|\___/|_| |_|____/ \___/|_| \__|
____ _ _ _ ____ _ | ||
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_ | ||
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __| | ||
___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_ |
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.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: all.pyjava
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Java/SelectionSort.java
+++ b/tmp/tmpz6y7xvz3/selection_sort/Java/SelectionSort.java
@@ -4,7 +4,7 @@
____ _ _ _ ____ _
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __|
- ___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
+ ___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_
|____/ \___|_|\___|\___|\__|_|\___/|_| |_|____/ \___/|_| \__|
*/
# date: 10.28.2018 | ||
|
||
import random | ||
|
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.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: all.autopep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -10,6 +10,7 @@
# date: 10.28.2018
import random
+
def sort(a):
max_idx = len(a) - 1
def sort(a): | ||
max_idx = len(a) - 1 | ||
for idx in range(0, max_idx): | ||
min_idx = idx |
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.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: all.autopep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -14,7 +14,7 @@
def sort(a):
max_idx = len(a) - 1
for idx in range(0, max_idx):
- min_idx = idx
+ min_idx = idx
for i in range(idx+1, max_idx+1):
if a[i] < a[min_idx]:
min_idx = i
for i in range(idx+1, max_idx+1): | ||
if a[i] < a[min_idx]: | ||
min_idx = i | ||
a[idx], a[min_idx] = a[min_idx], a[idx] |
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.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: all.autopep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
+++ b/tmp/tmpz6y7xvz3/selection_sort/Python/selection_sort.py
@@ -18,9 +18,9 @@
for i in range(idx+1, max_idx+1):
if a[i] < a[min_idx]:
min_idx = i
- a[idx], a[min_idx] = a[min_idx], a[idx]
+ a[idx], a[min_idx] = a[min_idx], a[idx]
return a
-
+
if __name__ == "__main__":
rand_list = random.sample(range(1000), 40)
@@ -0,0 +1,28 @@ | |||
''' | |||
____ _ _ _ ____ _ |
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.
W291 trailing whitespace
Origin: PycodestyleBear (W291), Section: all.autopep8
.
@@ -0,0 +1,28 @@ | |||
''' | |||
____ _ _ _ ____ _ | |||
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_ |
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.
W291 trailing whitespace
Origin: PycodestyleBear (W291), Section: all.autopep8
.
____ _ _ _ ____ _ | ||
/ ___| ___| | ___ ___| |_(_) ___ _ __ / ___| ___ _ __| |_ | ||
\___ \ / _ | |/ _ \/ __| __| |/ _ \| '_ \\___ \ / _ \| '__| __| | ||
___) | __| | __| (__| |_| | (_) | | | ___) | (_) | | | |_ |
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.
W291 trailing whitespace
Origin: PycodestyleBear (W291), Section: all.autopep8
.
|
||
import random | ||
|
||
def sort(a): |
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.
E302 expected 2 blank lines, found 1
Origin: PycodestyleBear (E302), Section: all.autopep8
.
def sort(a): | ||
max_idx = len(a) - 1 | ||
for idx in range(0, max_idx): | ||
min_idx = idx |
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.
W291 trailing whitespace
Origin: PycodestyleBear (W291), Section: all.autopep8
.
for i in range(idx+1, max_idx+1): | ||
if a[i] < a[min_idx]: | ||
min_idx = i | ||
a[idx], a[min_idx] = a[min_idx], a[idx] |
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.
W291 trailing whitespace
Origin: PycodestyleBear (W291), Section: all.autopep8
.
min_idx = i | ||
a[idx], a[min_idx] = a[min_idx], a[idx] | ||
return a | ||
|
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.
W293 blank line contains whitespace
Origin: PycodestyleBear (W293), Section: all.autopep8
.
For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!
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
.After you submit your pull request, DO NOT click the 'Update Branch' button.