Skip to content
Snippets Groups Projects
Commit babc2879 authored by Gabriel Ruschel's avatar Gabriel Ruschel
Browse files

BubbleSort

parent 216b3c1e
Branches
No related tags found
No related merge requests found
......@@ -21,3 +21,19 @@ void SelectSort (int *Vetor) {
Troca (Vetor, i, menor);
}
}
void BubbleSort (int *Vetor) {
bool trocou;
int i;
trocou = true;
while (trocou) {
trocou = false;
for (i=0; i < TAM; i++) {
if (Vetor[i] > Vetor[i+1]) {
Troca(Vetor,i,i+1);
trocou = true;
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment