**fig7_15.txt** /* 1*/ template /* 2*/ void /* 3*/ Q_Sort( Etype A[ ], /* 4*/ const unsigned int Left, const unsigned int Right ) /* 5*/ { /* 6*/ if( Left + Cutoff <= Right ) /* 7*/ { /* 8*/ Etype Pivot = Median3( A, Left, Right ); /* 9*/ unsigned int i = Left + 1, j = Right - 1; /*10*/ for( ; ; ) /*11*/ { /*12*/ while( A[ i ] < Pivot ) i++; /*13*/ while( A[ j ] > Pivot ) j--; /*14*/ if( i < j ) /*15*/ Swap( A[ i ], A[ j ] ); /*16*/ else /*17*/ break; /*18*/ } /*19*/ Swap( A[ i ], A[ Right - 1 ] ); // Restore pivot. /*20*/ Q_Sort( A, Left, i - 1 ); /*21*/ Q_Sort( A, i + 1, Right ); /*22*/ } /*23*/ }