public class BubbleSort {
public static void main(String [] args) {
int arrayInt [] = {8,7,1,9,10,7};
System.out.println("Array desordenado");
showArray(arrayInt);
System.out.println("Array ordenado Ascendente");
ordenamientoBurbujaAscendente(arrayInt);
showArray(arrayInt);
System.out.println("Array ordenado descendente");
ordenamientoBurbujaDescendente(arrayInt);
showArray(arrayInt);
}
public static void showArray(int showArray[]) {
for (int index = 0; index < showArray.length; index++) {
System.out.println("en la posición [ "+index+" ] tiene el valor : " +showArray[index]);
}
}
public static void ordenamientoBurbujaAscendente(int sortarray []){
int temp=0;
for (int index= 0; index < sortarray.length-1; index++) {
for (int compare = 0; compare< sortarray.length-1; compare++) {
if (sortarray[compare]>sortarray[compare+1]){
temp = sortarray[compare];
sortarray[compare]=sortarray[compare+1];
sortarray[compare+1]=temp;
}
}
}
}
public static void ordenamientoBurbujaDescendente(int sortarray []){
int temp=0;
for (int index= 0; index < sortarray.length-1; index++) {
for (int compare = 0; compare< sortarray.length-1; compare++) {
if (sortarray[compare]<sortarray[compare+1]){
temp = sortarray[compare];
sortarray[compare]=sortarray[compare+1];
sortarray[compare+1]=temp;
}
}
}
}
}
so mequetrefe son el mismo
ResponderBorrarno sirvio pa una verga -10
ResponderBorrarGrand Casino Hotel, Las Vegas - Mapyro
ResponderBorrarFind 속초 출장샵 the closest 사천 출장샵 casino 세종특별자치 출장샵 to Grand Las Vegas. Mapyro's 30000 room gaming floor features nearly 원주 출장샵 80,000 square feet of gaming 문경 출장안마 floor space and