-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
38 lines (25 loc) · 950 Bytes
/
main.c
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 <time.h>
#include "functions.h"
#include "algorithmes/insertion_sort.h"
#include "algorithmes/bubble_sort.h"
#include "algorithmes/merge_sort.h"
#include "algorithmes/quick_sort.h"
#include "algorithmes/heap_sort.h"
int main(){
srand(time(NULL));
char function_names[5][20] = {"Insertion Sort", "Bubble Sort", "Merge Sort", "Quick sort", "Heap sort"};
int (* fonctions [5])(long*, long) = {insertionSort, bubbleSort, mergeSort, quickSort, heapSort};
long *tab = NULL;
long debut = 500, fin = 2048000;
int taille;
tab = generer_tailles_tableaux(debut, fin, &taille);
for (int i = 0; i < 5; i++) {
printf("%s started.\n", function_names[i]);
StoreTime* results = tab_execution(fonctions[i], tab, taille);
writeCSV(function_names[i], results, taille);
printf("%s done.\n\n", function_names[i]);
}
return EXIT_SUCCESS;
}