E ae galera, blza?
To tentando implementar um quicksort que ordena em ordem descrescente. Eu fiz algumas mudanças mas não sei se é suficiente . A mudança feita foi na linha 13, onde troquei o <= por >=.
Deem sugestoes ae!
[code]
public void quicksort(int p, int q, int array[]){
if (p < q){
int x = particao(p, q, array);
quicksort(p, x - 1, array);
quicksort(x + 1, q, array);
}
}
public int particao(int p, int q, int array[]){
int j = p - 1;
int aux = array[q];
for (int i = p; i <= q; i++){
if (array[i] >= aux);
troca(array, i, ++j);
}
return j;
}
public void troca(int array[], int i, int j){
int aux = array[i];
array[i] = array[j];
array[j] = aux;
}[/code]
Valeu[/code]