-
Notifications
You must be signed in to change notification settings - Fork 300
Java counting sort #377
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
Java counting sort #377
Conversation
Comment on d133706, file counting_sort/Java/count_sort.java, line 28. Line contains following spacing inconsistencies:
Origin: SpaceConsistencyBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmp3fxanglr/counting_sort/Java/count_sort.java
+++ b/tmp/tmp3fxanglr/counting_sort/Java/count_sort.java
@@ -25,7 +25,7 @@
*/
int maximum_number = getMax(arr); // get the max number in the array in order to declare count array.
int[] count_arr = new int[maximum_number + 1]; // maximum_number + 1 as we need to correctly
- //map each index with the number in the array
+ //map each index with the number in the array
for (int i = 0; i < count_arr.length; i++) {
count_arr[i] = 0; |
This comment has been minimized.
This comment has been minimized.
I think the patch suggests I have CountSort.java as the filename. I changed that to count_sort.java to adhere to the repo coding guidelines. Can you provide a new patch please? |
I converted all tabs to spaces. Please let me know in case of any other issues. |
Comment on 8f1a886, file counting_sort/Java/CountSort.java, line 28. Line contains following spacing inconsistencies:
Origin: SpaceConsistencyBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmpc_mpjr4g/counting_sort/Java/CountSort.java
+++ b/tmp/tmpc_mpjr4g/counting_sort/Java/CountSort.java
@@ -25,7 +25,7 @@
*/
int maximum_number = getMax(arr); // get the max number in the array in order to declare count array.
int[] count_arr = new int[maximum_number + 1]; // maximum_number + 1 as we need to correctly
- //map each index with the number in the array
+ //map each index with the number in the array
for (int i = 0; i < count_arr.length; i++) {
count_arr[i] = 0; |
@sangamcse This is my first pull request. How do I apply this patch? |
import java.util.Collections; | ||
|
||
class CountSort { | ||
/** |
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/tmpn7_d42aj/counting_sort/Java/count_sort.java
+++ b/tmp/tmpn7_d42aj/counting_sort/Java/count_sort.java
@@ -25,7 +25,7 @@
*/
int maximum_number = getMax(arr); // get the max number in the array in order to declare count array.
int[] count_arr = new int[maximum_number + 1]; // maximum_number + 1 as we need to correctly
- //map each index with the number in the array
+ //map each index with the number in the array
for (int i = 0; i < count_arr.length; i++) {
count_arr[i] = 0;
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.
@sangamcse Hey Sangam, I am unable to apply patches.
These are the errors I get ->
error: counting_sort/Java/CountSort.java: No such file or directory
error: patch failed: counting_sort/Java/count_sort.java:37
error: counting_sort/Java/count_sort.java: patch does not apply
error: counting_sort/Java/CountSort.java: No such file or directory
Can you please help me with this?
import java.util.Collections; | ||
|
||
class CountSort { | ||
/** |
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/tmpwep5ebii/counting_sort/Java/count_sort.java
+++ b/tmp/tmpwep5ebii/counting_sort/Java/count_sort.java
@@ -25,7 +25,7 @@
*/
int maximum_number = getMax(arr); // get the max number in the array in order to declare count array.
int[] count_arr = new int[maximum_number + 1]; // maximum_number + 1 as we need to correctly
- //map each index with the number in the array
+ //map each index with the number in the array
for (int i = 0; i < count_arr.length; i++) {
count_arr[i] = 0;
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.
Squash your commits into one
This adds Counting Sort implemented in java.
It returns the sorted array.
Here is the wiki link : https://en.wikipedia.org/wiki/Counting_sort