Skip to content

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

Closed
wants to merge 14 commits into from
Closed

Conversation

tosirap
Copy link

@tosirap tosirap commented Apr 3, 2018

I add the algorithm of combSort.java in the Sort directory

*
*/

public class combSort{

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.



public static <T extends Comparable<T>> void CS(T[] arr, int n) {
int intervalle = n; //initialisation of intervalle

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the indent

boolean echange = true; //initialisation at true;

while(intervalle>1 || echange==true){
intervalle =(int)(intervalle/1.3);

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;

int intervalle = n; //initialisation of intervalle
boolean echange = true; //initialisation at true;

while(intervalle>1 || echange==true){

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.


// Integer Input
int[] arr1 = {4,23,6,78,1,54,231,9,12};
int n = arr1.length;

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.

**/


public static <T extends Comparable<T>> void CS(T[] arr, int n) {

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.


// Output => 1 4 6 9 12 23 54 78 231
for(int i=0; i<n; i++)
{

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

**/


public static <T extends Comparable<T>> void CS(T[] arr, int n) {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants