public static void combSort11 ( double arrayToSort [ ] , int linkedArray [ ] ) { int switches , j , top , gap ; double hold1 ; int hold2 ; gap = arrayToSort . length ; do { gap = ( int ) ( gap / 1.3 ) ; switch ( gap ) { case 0 : gap = 1 ; break ; case 9 : case 10 : gap = 11 ; break ; default : break ; } switches = 0 ; top = arrayToSort . length - gap ; for ( int i = 0 ; i < top ; i ++ ) { j = i + gap ; if ( arrayToSort [ i ] > arrayToSort [ j ] ) { hold1 = arrayToSort [ i ] ; hold2 = linkedArray [ i ] ; arrayToSort [ i ] = arrayToSort [ j ] ; linkedArray [ i ] = linkedArray [ j ] ; arrayToSort [ j ] = hold1 ; linkedArray [ j ] = hold2 ; switches ++ ; } //endif } //endfor } while ( switches > 0 || gap > 1 ) ; }
sorts the two given arrays .