question: public void sortWithIndex ( int xi , int xj , IntVector index ) { if ( xi < xj ) { double x ; int xm = ( xi + xj ) / 2 ; x = Math . min ( V [ xi ] , Math . max ( V [ xm ] , V [ xj ] ) ) ; int i = xi ; int j = xj ; while ( i < j ) { while ( V [ i ] < x && i < xj ) { i ++ ; } while ( V [ j ] > x && j > xi ) { j -- ; } if ( i <= j ) { swap ( i , j ) ; index . swap ( i , j ) ; i ++ ; j -- ; } } sortWithIndex ( xi , j , index ) ; sortWithIndex ( i , xj , index ) ; } }
target:  Sorts the array in place with index changed