// An example sorting procedure, based on the insertion-sort
// algorithm. Note that it is inefficient for large arrays.
// Also note that the code slightly differs from the lecture
// notes, because the array in C begins with index 0.
void sort(int* a, int n) {
	int i, j, key;
	for (j = 1; j < n; j++) {
		key = a[j];
		i = j - 1;
		while (i >= 0 && a[i] > key) {
			a[i + 1] = a[i];
			i = i - 1;}
		a[i + 1] = key;}}
