private void computeBucketSize2_SaBucket ( int leftPtr , int rightPtr , int offset , int q ) { int suffix1 = suffixArray [ leftPtr ] + offset ; int suffix2 = suffixArray [ rightPtr ] + offset ; while ( sufPtrMap [ suffix1 ] == sufPtrMap [ suffix2 ] ) { suffix1 += q ; suffix2 += q ; } if ( sufPtrMap [ suffix1 ] > sufPtrMap [ suffix2 ] ) { int tmpSwap = suffixArray [ leftPtr ] ; suffixArray [ leftPtr ] = suffixArray [ rightPtr ] ; suffixArray [ rightPtr ] = tmpSwap ; } sufPtrMap [ suffixArray [ leftPtr ] ] = leftPtr ; sufPtrMap [ suffixArray [ rightPtr ] ] = rightPtr ; }
Completely sorts buckets of size 2 .