Foros del Web » Programación para mayores de 30 ;) » .NET »

como mostrar quiksort en la misma clase??

Estas en el tema de como mostrar quiksort en la misma clase?? en el foro de .NET en Foros del Web. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código java: Ver original public void quickSort ( int [ ] v, int inicio, int fin ) {           ...
  #1 (permalink)  
Antiguo 09/05/2013, 15:41
 
Fecha de Ingreso: noviembre-2012
Ubicación: santiago
Mensajes: 23
Antigüedad: 11 años, 5 meses
Puntos: 0
como mostrar quiksort en la misma clase??

Código java:
Ver original
  1. public void quickSort(int[] v, int inicio, int fin) {
  2.      
  3.     if(inicio>=fin)
  4.          
  5.          
  6.  
  7.             return ;          
  8.  
  9.  
  10.         int pivote = v[inicio];
  11.         int izq    = inicio+1;
  12.         int der    = fin;
  13.  while(izq<=der) {
  14.  
  15.        
  16.             while(izq<=fin   && v[izq]< pivote) izq++;
  17.             while(der>inicio && v[der]>=pivote) der--;
  18.             if(izq<der) {
  19.                 int tmp = v[izq];
  20.                 v[izq]  = v[der];
  21.                 v[der]  = tmp;
  22.             }
  23.         }
  24.  
  25.      
  26.         if(der>inicio) {
  27.             int tmp  = v[inicio];
  28.             v[inicio]= v[der];
  29.             v[der]   = tmp;
  30.         }
  31.  
  32.  
  33.         quickSort(v,inicio, der-1);
  34.         quickSort(v, der+1, fin);
  35.        
  36.  
  37.            
  38. }
  39.    
  40.   public void clsMostrar (){
  41.  
  42.  for (int x = 0; x < v.length; x++) {
  43.              
  44.              
  45.               System.out.println("Ordenamiento Quiksort["+v[x]+"]");  
  46.          
  47. }//
  48.  
  49.   }

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:59.