Element number n gets inserted at the proper position and all already inserted (indices 0..n-1) elements get moved one position.
for (int i = 1; i < array.count(); ++i) {
int j = i;
while (j > 0) {
if (array[j-1] > array[j]) {
array.swap( j-1, j );
}
--j;
}
}⇒
⇒