blob: 053822a3086b875e735ca074220a6d11b21726c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "heapsort.h"
#include "../cycles.h"
int main (void) {
cycle_count_config();
unsigned len=30000;
data *vec = malloc(sizeof(data) * len);
data_vec_random(vec, len);
cycle_t heapsort_time = get_cycle();
heapsort(vec, len);
heapsort_time = get_cycle() - heapsort_time;
printf("sorted=%s\n"
"heapsort_time:%" PRIu64 "\n",
data_vec_is_sorted(vec, len)?"true":"false",
heapsort_time);
free(vec);
return 0;
}
|