Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/09/2012, 17:51
Avatar de Doommarine_Maxi
Doommarine_Maxi
 
Fecha de Ingreso: febrero-2011
Mensajes: 54
Antigüedad: 13 años, 3 meses
Puntos: 8
Respuesta: Ordenamiento Burbuja

Puedes reducirlo aun mas, por ejemplo haciendo solo un bucle.


Código C++:
Ver original
  1. for (int i=0; i < TAM; i++)
  2. {
  3.       if (i < 1)
  4.             continue;
  5.       if (v[i] < v[i-1])
  6.       {
  7.             aux = v[i];
  8.             v[i] = v[i-1];
  9.             v[i-1] = aux;
  10.             i = 0;
  11.       }
  12. }