// single threaded pseudo-code Q=5 // Q is magic number Sel( k, a, size ) { if ( size < Q*Q ) { Sort( a, size); return a[k]; } // Q*Q is magic number // split into chunks and sort each chunk for ( i=0; i mm ) { ++countB; marks[ i ] = B; } // bigger else { ++countE; marks[ i ] = E; } // equal } if ( k < countL ) { int a2[ countL ]; int j=0; for ( i=0; i countL+countE ) { int a2[ countB ]; int j=0; for ( i=0; i