hmm...
sorry for my ignorance.
it wasn't clear to me which way your sorted array was increasing.
specially when you were going it backwards up in the for loop, it got me confused.
_________________________
!

download KiXnet