-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDQSC.c
More file actions
38 lines (35 loc) · 727 Bytes
/
DQSC.c
File metadata and controls
38 lines (35 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include "lista.h"
#include "serial.h"
#include <string.h>
#define TAM 16300
#define CASO 1 //0 peor caso 1 promedio 2 mejor
void generador(int caso,char archivo[]){
int i = 0;
Lista A;
long double tiempo;
FILE *fp = fopen(archivo,"w+");
for(i=1;i<=TAM;i++){
tiempo = 0;
A = crearLista(i);
fillList(&A,caso);
tiempo = omp_get_wtime();
doubleQuickSort(&A);
tiempo = omp_get_wtime() - tiempo;
fprintf(fp,"%d,%Lf\n",A.tam,tiempo);
if(i<TAM)
free(A.elementos);
}
printf("Lista final");
printList(A);
fclose(fp);
free(A.elementos);
}
int main(){
generador(0,"Peor.txt");
generador(1,"Promedio.txt");
generador(2,"Mejor.txt");
return 0;
}