You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
523 B
C
31 lines
523 B
C
3 years ago
|
#include <stdio.h>
|
||
|
#include <stdbool.h>
|
||
|
#include <time.h>
|
||
|
#include <stdlib.h>
|
||
|
#include "sorts.c"
|
||
|
#define ALEN 1000
|
||
|
#define DISPLEN 25
|
||
|
#define THRESHOLD 25
|
||
|
|
||
|
int main() {
|
||
|
srand(time(NULL));
|
||
|
int a[ALEN];
|
||
|
for (int i = 0; i < ALEN; a[i++] = rand() % (2 * ALEN));
|
||
|
|
||
|
printf("Before:\n");
|
||
|
for (int i = 0; i < DISPLEN; ++i) {
|
||
|
printf("%d ", a[i]);
|
||
|
}
|
||
|
putchar('\n');
|
||
|
|
||
|
//bubblesort(a, ALEN);
|
||
|
insertion(a, ALEN);
|
||
|
printf("After:\n");
|
||
|
for (int i = 0; i < DISPLEN; ++i) {
|
||
|
printf("%d ", a[i]);
|
||
|
}
|
||
|
putchar('\n');
|
||
|
|
||
|
return 0;
|
||
|
}
|