all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,19 @@
#include <stddef.h>
static void insertion_sort(int *a, const size_t n) {
size_t i, j;
int value;
for (i = 1; i < n; i++) {
value = a[i];
for (j = i; j > 0 && value < a[j - 1]; j--) {
a[j] = a[j - 1];
}
a[j] = value;
}
}
int main(void) {
int a[] = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1};
insertion_sort(a, sizeof a / sizeof a[0]);
return 0;
}