Skip to content
Snippets Groups Projects
Commit ae63dc92 authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

Mandando arquivos que esqueci no ultimo commit

parent 141e62ee
No related branches found
No related tags found
No related merge requests found
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/time.h> #include <sys/time.h>
#define TAM 5 //tamanho do vetor #define TAM 100 //tamanho do vetor
#define NUMMAX 10 //constante que tem o máximo de valores #define NUMMAX 10 //constante que tem o máximo de valores
No preview for this file type
...@@ -24,10 +24,11 @@ int Mediana (int Esquerda, int Meio, int Direita) { ...@@ -24,10 +24,11 @@ int Mediana (int Esquerda, int Meio, int Direita) {
} }
int Particao (int Vetor[], int Esquerda, int Direita) { int Particao (int Vetor[], int Esquerda, int Direita) {
int Pivo = Mediana (Vetor[Esquerda], Vetor[Esquerda+Direita/2+1], Vetor[Direita]); int Pivo, i, j;
int i = (Esquerda - 1);
for (int j = Esquerda; j <= Direita- 1; j++) Pivo = Vetor[Direita];
i = (Esquerda - 1);
for (j = Esquerda; j <= Direita- 1; j++)
{ {
if (Vetor[j] <= Pivo) if (Vetor[j] <= Pivo)
{ {
...@@ -36,7 +37,6 @@ int Particao (int Vetor[], int Esquerda, int Direita) { ...@@ -36,7 +37,6 @@ int Particao (int Vetor[], int Esquerda, int Direita) {
} }
} }
Troca (Vetor,i + 1, Direita); Troca (Vetor,i + 1, Direita);
printVetor (Vetor, 8);
return (i+1); return (i+1);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment