Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
229 B
7
Indexable
Never
void sort(int n, int *a) {
    for (int i = 1; i < n; i++) {
        int j = i - 1;
        int k = a[i];
        while (j >= 0 && k < a[j]) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = k;
    }
}