Advertisement
urksiful

Burbuja_By_Method

Nov 15th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.ArrayList;
  2.  
  3. public class Burbuja {
  4.     public  void Ordenar( ArrayList<Integer> arreglo, int tam){
  5.         int x, y, aux;
  6.        
  7.         for(x=0;x<tam-1; x++){
  8.             for(y=x+1;y<tam;y++){
  9.                 if(arreglo.get(x)>arreglo.get(y)){
  10.                     aux=arreglo.get(x);
  11.                     arreglo.set(x, arreglo.get(y));
  12.                     arreglo.set(y, aux);
  13.                 }
  14.             }
  15.            
  16.         }
  17.        
  18.  
  19.     }
  20.    
  21.    
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement