Closest-pair problem/C: Difference between revisions
m
Fixed syntax highlighting.
(replaced code) |
m (Fixed syntax highlighting.) |
||
(One intermediate revision by one other user not shown) | |||
Line 1:
{{collection|Closest pair problem}}
<
#include <stdlib.h>
#include <values.h>
Line 21:
int cmp_x(const void *a, const void *b) {
return cmp_dbl( (*(
}
int cmp_y(const void *a, const void *b) {
return cmp_dbl( (*(
}
Line 137:
/* not freeing the memory, let OS deal with it. Habit. */
return 0;
}</
% gcc -Wall -lm -O2 test.c
% time ./a.out
min: 5.6321e-05; point (19.657247,79.900855) and (19.657303,79.900862)
./a.out 7.16s user 0.08s system 96% cpu 7.480 total
</
|