distribute( )
{int i, hbot, s;
typekey lastout;
for (i=0; i=0) {
for (hbot=0; hbot= 0) {
lastout = Buff[0].k;
WriteFile( s, Buff[0] );
Buff[0] = Buff[hbot];
siftup( Buff, 0, hbot-1 );
if ( !Eof(1) ) Buff[hbot] = ReadFile(1);
if ( Eof(1) ) Buff[hbot--] = Buff[i--];
else if ( Buff[hbot].k < lastout ) hbot--;
else insert( hbot, Buff );
}
}
};
|