Добавил к седьмому заданию сравнение разных сортировок, сделал 9е задание на массивы

This commit is contained in:
AZEN-SGG 2024-12-04 13:25:05 +03:00
parent c33f7295d5
commit a45af76154
25 changed files with 599 additions and 23 deletions

View file

@ -1,27 +1,35 @@
#include <stdio.h>
#include "quicksort.h"
#include "seagwithsob.h"
#include "tools.h"
#include "stdlib.h"
void iquicksort(double * array, int length);
int main(void) {
FILE * file = getFile();
double * array;
double * orig_arr;
int length;
// FILE * file = getFile();
// double * array;
// double * orig_arr;
// int length;
//
// if (file == NULL) return -1;
// array = getArray(file);
// if (array == NULL) return -2;
// length = (int)array[0] - 1;
//
// orig_arr = array;
// array = &array[1];
// testSort(array, length, quicksort);
//
// free(orig_arr);
if (file == NULL) return -1;
array = getArray(file);
if (array == NULL) return -2;
length = (int)array[0] - 1;
orig_arr = array;
array = &array[1];
testSort(array, length, quicksort);
free(orig_arr);
printf("\n");
testSortRandomArray(quicksort);
// printf("\n");
// testSortRandomArray(quicksort;
compareSorts(quicksort, iquicksort);
return 0;
}
void iquicksort(double * array, int length) {
qsort(array, length, sizeof(double), compare);
}