// Bubble-sort 16 ints.  Exercises array indexed access, nested loops,
// and i16 compare/swap — patterns common in any sorted-collection code.
void bubbleSort(short *a, unsigned short n) {
    for (unsigned short i = 0; i < n - 1; i++) {
        for (unsigned short j = 0; j < n - 1 - i; j++) {
            if (a[j] > a[j + 1]) {
                short t = a[j];
                a[j] = a[j + 1];
                a[j + 1] = t;
            }
        }
    }
}
