The shiftDownElements gets handed elements in this order:
A9, A10, A11, A5, A6, A7, A8
When A9 is shifted down to make room for A10, that causes A9 to be below A10
I presume that you need the elements passed to that function in this order?
A11, A10, A9, A8, A7, A6, A5