Last active
April 4, 2017 05:04
-
-
Save JMGama/7efe891023e75f46fd1168393f75f612 to your computer and use it in GitHub Desktop.
Bubble method in java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void burbuja(int[] Arreglo) { | |
int i, j, aux; | |
for (i = 0; i < Arreglo.length -1; i++) { | |
for (j = 0; j < Arreglo.length -1; j++) { | |
if (Arreglo[j] > Arreglo[j + 1]) { | |
aux = Arreglo[j]; | |
Arreglo[j] = Arreglo[j + 1]; | |
Arreglo[j + 1] = aux; | |
} | |
} | |
} | |
for(i = 0; i< Arreglo.length; i++){ | |
System.out.println(Arreglo[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment