-
Notifications
You must be signed in to change notification settings - Fork 20k
adding of the combSort.java #403
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
Conversation
Sorts/combSort.java
Outdated
* | ||
*/ | ||
|
||
public class combSort{ |
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 respect naming conventions. Class names begin with upper case. Rename your file, too.
Sorts/combSort.java
Outdated
|
||
|
||
public static <T extends Comparable<T>> void CS(T[] arr, int n) { | ||
int intervalle = n; //initialisation of intervalle |
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.
Correct the indent
Sorts/combSort.java
Outdated
boolean echange = true; //initialisation at true; | ||
|
||
while(intervalle>1 || echange==true){ | ||
intervalle =(int)(intervalle/1.3); |
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.
You can simple write intervalle /= 1.3;
Sorts/combSort.java
Outdated
int intervalle = n; //initialisation of intervalle | ||
boolean echange = true; //initialisation at true; | ||
|
||
while(intervalle>1 || echange==true){ |
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.
Instead of echange==true
you can write echange
. Please write spaces between the operators.
Sorts/combSort.java
Outdated
|
||
// Integer Input | ||
int[] arr1 = {4,23,6,78,1,54,231,9,12}; | ||
int n = arr1.length; |
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.
unnecessary. Use the length
attribute of the array.
Sorts/combSort.java
Outdated
**/ | ||
|
||
|
||
public static <T extends Comparable<T>> void CS(T[] arr, int n) { |
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.
n
is unnecessary. Use the length
attribute of the array.
Sorts/combSort.java
Outdated
|
||
// Output => 1 4 6 9 12 23 54 78 231 | ||
for(int i=0; i<n; i++) | ||
{ |
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 respect code style conventions for bracketing. see
Sorts/combSort.java
Outdated
**/ | ||
|
||
|
||
public static <T extends Comparable<T>> void CS(T[] arr, int n) { |
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.
Java methods begin with lower case.
Input : Source base , Source number , Destination base Output : Destination Number
modification of CombSort
I add the algorithm of combSort.java in the Sort directory